For a certain segment of the millennial generation, Carly Rae Jepsen’s “Call Me Maybe” is much more than a catchy tune.

The pop anthem came out in 2012, when millennials were in their late teens and early-to-mid 20s, and for over a year, it was inescapable. It played during commutes, parties, and workouts, and, really, everywhere else you went that year.

If you’re a millennial, probably can’t help but mentally return to the days when you first heard “Call Me Maybe” when it comes on in 2018. For Gen-Xers, though, Jepsen’s song may be catchy, but it won’t trigger the nostalgia of, say, “Right Here Right Now” by Jesus Jones.

Music from our teenage years holds a special place in our minds for two reasons. First off, when we listen to melodies and harmonies, more areas of the brain kick into action to process and understand those sounds than when we hear spoken words alone. Second, we’re evolutionarily primed to take in a lot more social and emotional information during our teenage years than in other part of our life. It’s why your ultimate throwback playlist really depends on when you were in the throes of adolescence.

A lot of that has to do with evolution, and, in particular, the behavioral adaptations humans made to make it through their teens. If you think puberty and young adulthood were rough, consider how bad they were for our ancient ancestors.

As Frank McAndrew, an evolutionary psychologist at Knox College in Illinois, has previously written for Quartz, the immense pressure teens of all generations feel to be liked is based on the survival instincts developed by humans hundreds of millions of years ago. Back in those hunter-gatherer days, you needed to be popular enough in your teen years to attract a mate (evolution’s only goal), and you certainly didn’t want to be a loser because that could get you ostracized from the group—leaving you vulnerable to the elements or starvation.

Young adults became sponges for social information to help them get ahead.

It was therefore crucial for teens living millions of years ago to absorb as much social information as possible, McAndrew postulates, to effectively jockey for status among their peers. The massive changes the brain undergoes during adolescence likely helps the brain retain loads of emotionally charged memories—especially common during teenage years, given the stakes of attaining status at that time. Young adults, therefore, became sponges for social information to help them get ahead and ultimately survive.

Music also has a way of working itself deep into our memories because of the attention it requires from several regions of our brain. While listening to music, different parts of the brain work in harmony, including those involved with processing sound, and deciphering speech and pitch, and even more if you’re singing along or picturing the scenes described in a song, says Angela Nazarian, a cognitive neuroscience graduate student at the University of California-Davis.

We also tend to turn to music when we have intense feelings. Our teenage and young-adult years are very often emotionally high-charged, especially because figuring out who we are at those ages can be isolating. “Listening to music provides a sense of social belongingness during what can be a pretty lonely period,” Nazarian says. As a teen you may have felt like there was no one in your high school or town understood you, but music offers a way to connect to a larger community not confined by geography.

In contemporary industrialized society, the choices teens make in high school and college can have permanent effects on their adulthood, but (usually) it’s not a time when life or death decisions are made. Despite the high stakes of our teenage years, it’s still fairly easy to reinvent ourselves in adulthood if we so choose.

But we’re still walking around with cave-teen brains, McAndrew says, that perceive what’s happening as life-defining. That might explain the “reminiscence bump” psychologists have observed in adults: memories from our late teens and early 20s tend to stay the strongest in our minds. It could also be why songs we are exposed to for the first time in those years stick in the mind for decades later, even if we go long periods of time without hearing those particular songs.

“It’s rare that people will retreat and only listen [to music]. Usually we’re doing something [else] at the same time,” Nazarian says, like driving, exercising, or dancing. Music is usually a backdrop to whatever it is we’re doing, but our brains are still taking in information about the whole environment. You may not remember the words or even the melody of the song that was playing during the first time you drove a car on your own, with your own license, but that song happened to come on the radio or show up on a Spotify playlist today, it might trigger intense memories of that moment.

“We’re not programmed for happiness. We’re programmed for striving.”

It’s fun to hear throwback playlists from our adolescence because it makes us reminisce about that time period. McAndrew hypothesizes that this sort of deep nostalgia is the result of feeling like there was a time when our life circumstances were better than they are today. This may be an impossible goal. “We’re not programmed for happiness,” McAndrew says. “We’re programmed for striving.” That sounds kind of awful, but the evolutionary advantage is that nostalgia can inspire us to figure out how we can improve our lives to be happy like we think we once were, which, in the past, was helpful for survival. The constant feeling that life could be improved could have been what set our ancestors apart from other early humans; those who were too content with their lives weren’t on the prowl for any opportunities to make them better. And those that stopped striving may have been more likely to die before they could have children.

So all those feelings that come flooding back when you hear the slow-song from prom night? They’re the just the fun remnants of an old evolutionary trick.

Correction (Oct. 28): An earlier version of this story mistakenly referred to Frank McAndrew as Frank McAnderson.