Both of your examples are correct, but have different meanings. "Mary is doing a lot of exercise" means that Mary is doing a lot of physical exertion. "Mary is doing a lot of exercises" means that Mary is doing various types of physical exertion.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.