3. B.
Let a1=2005, then m=1 is possible;
Let a2=2005, then m=2 is possible;
Let a1=18,a2=41. Then
a3=a12+a22=324+1681=2005,
so m=3 is also possible.
If m=4 is possible, then we have
2005=a22+(a12+a22)2(a1,a2∈N+).
Since 452=2025, we know that a12+a22⩽44, hence a1,a2⩽6.
Thus, (a12+a22)2=2005−a22∈[1969,2004].
However, 442=1936<1969<2004<452, which is a contradiction.
When m⩾5, similarly, it is not possible.