By the division algorithm we can write where .
But then, .
To find the remainder we need to simplify modulo .
Multiply both sides by seven to get, .
Now, by Fermat's little theorem.
Since we see that .
But this is remainder of only if you want to find remainder of just add 1.