We keep tracking of the running sum in total and we keep track of the remainders in a hash map from dividing this sum at each point with k. The idea is that if we ever get a remainder that we already saw before, we have a good subarray by taking the range [remainders[remainder]+1,i].