6. Given the sequence $\left\{a_{n}\right\}$ satisfies
$$
a_{n}=(\sqrt{2}+1)^{n}-(\sqrt{2}-1)^{n}(n \in \mathbf{N}) \text {. }
$$

Let $[x]$ denote the greatest integer not exceeding the real number $x$. Then the units digit of $\left[a_{2017}\right]$ is ( ).
(A) 2
(B) 4
(C) 6
(D) 8