Summing subsets , How to know that sum % Mod repeats after 22

can anyone please tell how can one know that result repeats after 22 in question RESN05 Problem - CodeChef , i spend a day on it but never got even close to thinking that it repeats after 22
RESN05 Problem - CodeChef

even i have the same doubt ???