input: def findMaxSum(limit: int, array: List[int]) -> int:
      """ Find the maximum sum of elements in the given array of non-negative integers
      that does not exceed the given upper limit.
      >>> findMaxSum(10, [1, 3, 5, 4, 2, 6])
      10
      >>> findMaxSum(15, [1, 2, 3, 4, 5])
      15
      """
output:     array.sort(reverse=True)
      current_sum = 0
      for num in array:
          if current_sum + num <= limit:
              current_sum += num
          if current_sum == limit:
              break
      return current_sum