Let M be the greatest integer such that both M+1500 and M+4000 are perfect squares. What is the units digit of M?
1
3
5
6
9