Watch the Study 2: Latin Groove online guitar lesson by Carl Verheyen from S.W.A.T Improvisation

The simplest way to play over these 2 chord changes is the Am pentatonic scale. The main reason it works is because it only contains the root, minor 3rd, 4th, 5th and flat 7 of the key. In this context the (nonexistent) 6th will determine the key of the moment, a concept you'll understand in a few more lessons.