A new approach to the sleep stages role in memory is discussed in the context of the two opposite patterns of behavior-search activity and renunciation of search. Search activity is activity designed to change the situation (or the subjects attitudes to it) in the absence of a definite forecast of the results of such activity, but with the constant consideration of these results at all stages of activity. Search activity increases general adaptability and body resistance while renunciation of search decreases adaptability and requires REM sleep for its compensation. Unprepared learning, which is often accompanied by failures on the first steps of learning, is suggested to produce renunciation of search, which decreases learning ability, suppress retention, and increase REM sleep requirement. A prolonged REM sleep deprivation before training causes learned helplessness and disturbs the learning process, while short REM sleep deprivation cause the "rebound" of the compensatory search activity that interferes with passive avoidance. REM sleep deprivation performed after a training session can increase distress caused by a training procedure, with the subsequent negative outcome on retention.