Since divided into bags of 2,3,4,5,6, all left one cookie, we have also another way.
Find the LCM (lowest common multiple) of 2,3,4,5,6. Call this L.
Check if L+1 is divisible by 7. If it is, L is your answer. If it is not, try 2L+1, 3L+1, ... until it is divisible by 7. You will not have to try more than 7 times.
If you are not sure how to find the LCM of 2,3,4,5,6, post again.