input: from typing import List
  
  def find_minimum_boxes_for_apples(apples: List[int], box_capacities: List[int]) -> int:
      """
      Given an array apples of length n and an array box_capacities of length m.
  
      There are n packs where the ith pack contains apples[i] apples. There are m boxes, where the ith box can hold up to box_capacities[i] apples.
  
      Return the minimum number of boxes required to distribute these n packs of apples into the boxes.
  
      Note: A pack of apples can be split across different boxes.
  
      Examples:
      >>> apples = [1,3,2], box_capacities = [4,3,1,5,2]
      2
      >>> apples = [5,5,5], box_capacities = [2,4,2,7]
      4
  
      Constraints:
      1 <= n == len(apples) <= 50
      1 <= m == len(box_capacities) <= 50
      1 <= apples[i], box_capacities[i] <= 50
      It is guaranteed that redistributing packs of apples into boxes is possible.
      """
output:     
      apples.sort(reverse=True)
      box_capacities.sort(reverse=True)
      
      box_count = 0
      i, j = 0, 0
      while i < len(apples):
          while j < len(box_capacities) and box_capacities[j] < apples[i]:
              j += 1
          if j < len(box_capacities):
              box_capacities[j] -= apples[i]
              if box_capacities[j] == 0:
                  j += 1
              i += 1
          else:
              break
      return box_count + (len(box_capacities) - j)
  