What is M referring to when talking about memory size( 4M x 8)
M in this context is just defined to be $2^{20}$, so if you have M items (bits, bytes, whatever), you'll have $2^{20}$ of them. The letter was chosen since it's the first letter in the term mega, meaning a million. Since $2^{10}=1024$ is close to $1000$, we'll have $2^{20}=(2^{10})^2≈(1000)^2=1000000$. M is sometimes called a "binary million".