input: from typing import List
  
  
  def findMaxSum(limit: int, array: List[int]) -> int:
      """ Given an upper limit value and a list of non-negative integers, find the
      maximum sum of any subarray that does not exceed the given limit.
      >>> findMaxSum(10, [1, 3, 5, 4, 2, 6])
      9
      >>> findMaxSum(5, [1, 2, 3, 4])
      5
      """
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