I thought that lengths of time were ans rather than annees. Why are we using annees here?
It's not really about lengths as much as about numbers. If there's a number, it's usually "ans", but after "quelques" or "plusieurs" for example, it will be "années".