Let M be the greatest integer such that both M+1000 and M+3000 are perfect squares. What is the units digit of M?
1
2
3
6
8