You are given an integer array nums (which may contain negative values) and an integer k.
Return the length of the longest contiguous subarray whose element sum is at most k. If no non-empty subarray has a sum of at most k, return 0.
Input: nums = [3, -2, 5, -1, 4], k = 6
Output: 4
Explanation: [3, -2, 5, -1] sums to 5 <= 6 and has length 4. The whole array sums to 9 > 6.
Input: nums = [5, 6, 7], k = 4
Output: 0
Explanation: Every element already exceeds 4, so no subarray qualifies.
Input: nums = [1, 2, 3, 4], k = 100
Output: 4
Explanation: The whole array sums to 10 <= 100.
nums.length ≤105nums[i] ≤104