input: from typing import List
  
  def findMaxSum(limit: int, array: List[int]) -> int:
      """
      Finds the maximum sum of an array of non-negative integers that is less than or equal to a given upper limit value.
      
      >>> findMaxSum(10, [1, 3, 5, 4, 2, 6])
      10
      >>> findMaxSum(8, [1, 3, 5, 4, 2, 6])
      7
      """
output:     dp = [0] * (limit + 1)
      for num in array:
          for i in range(limit, num - 1, -1):
              dp[i] = max(dp[i], dp[i - num] + num)
      return dp[limit]