Let M be the greatest integer such that both M+1001 and M+3401 are perfect squares. What is the units digit of M?
0
2
4
6
8