nums.left to 0, currentSum to 0, and maxFrequency to 0.nums using a variable right.right, add nums[right] to currentSum.left to right equal to nums[right] exceeds k, increment left and subtract nums[left] from currentSum.maxFrequency with the maximum of itself and the current window size (right - left + 1).maxFrequency as the result.