input: def findMaxSum(limit: int, array: List[int]) -> int:
      """ Find the maximum sum of any subarray in the given array that does not exceed the given limit.
      >>> findMaxSum(10, [1, 3, 5, 4, 2, 6])
      10
      >>> findMaxSum(7, [3, 2, 5, 1, 4])
      6
      """
output:     max_sum = float('-inf')
      current_sum = 0
      for num in array:
          current_sum += num
          if current_sum > max_sum and current_sum <= limit:
              max_sum = current_sum
          if current_sum < 0:
              current_sum = 0
      return max_sum if max_sum != float('-inf') else 0