In my lecturer's notes it says the following:
Let $A \subseteq M$ and let $B = \{U_i : i \in I\}$ be an open cover of $A$. When determining the compactness or not of $A$, we might question whether it matters whether the $U_i$ are open in $A$ or open in $M$. In fact, it does not matter whether the $U_i$ are open in $A$ and $A=\cup_{i \in I} U_i$ or whether the the $U_i$ are open in $M$ and $A \subseteq\cup_{i \in I} U_i$.
Why is this?
This is because compactness is independent of the ambient space. More formally stated, if $A \subset E \subset M$, then $A$ is compact in $E$ iff $A$ is compact in $M$. In your case, $E = A$ but the result still holds. This is because given an open (in $A$) cover of $A$, one can easily show from it the existence of an open (in $M$) cover of $A$, and vice versa.