Mental Model
We keep track of sums of elements from the start to each position and use a map to find if a previous sum allows a subarray to sum to k.
Analogy: Imagine walking along a path and noting the total distance walked at each step. If you want to find a segment of the path that is exactly k long, you check if you have been at a distance that is current distance minus k before.
Array: [1] -> [2] -> [3] -> [4] -> [5] Prefix sums: 0 -> 1 -> 3 -> 6 -> 10 -> 15 Hash map stores sums seen so far with their counts.
