The sum of subarray from i+1 to j is prefix[j]−prefix[i]. You want this to be at least k.
For each j, you're looking for the largest i<j such that prefix[j]−prefix[i]≥k, which means prefix[i]≤prefix[j]−k.
If prefix[i1]≥prefix[i2] where i1<i2, then i1 is never useful. Any j that could use i1 could use i2 instead and get a shorter subarray. This "dominated" insight means you can use a monotonic deque.