input: def findMaxSum(limit: int, array: List[int]) -> int:
      """
      Finds the maximum sum of a subarray within the given upper limit value.
  
      >>> findMaxSum(10, [1, 3, 5, 4, 2, 6])
      9
      >>> findMaxSum(15, [8, 4, 7, 6, 5, 2])
      15
      """
output:     max_sum = 0
      current_sum = 0
      for num in array:
          current_sum += num
          if current_sum > limit:
              current_sum = num
          if current_sum > max_sum:
              max_sum = current_sum
      return max_sum