input: Write a Python function that accepts two arrays, apples and box_capacity. The apples array represents the number of apples in each pack, and the box_capacity array represents the capacity of each box. The function should return the minimum number of boxes required to redistribute all the apples from the packs into these boxes. Note that apples from the same pack can be split across multiple boxes.
  
  Example:
  
  
  from typing import List
  
  def min_boxes_needed(apples: List[int], box_capacity: List[int]) -> int:
      # Given an array apples of size n and an array box_capacity of size m.
      # Each i-th element in apples represents the number of apples in the i-th pack.
      # Each i-th element in box_capacity represents the capacity of the i-th box.
      # Return the earliest number of boxes needed to redistribute all apple packs into boxes.
      # Apples from the same pack can be split across multiple boxes.
      
      # Examples:
      # apples = [1, 3, 2], box_capacity = [4, 3, 1, 5, 2]
      # return 2
      
      # apples = [5, 5, 5], box_capacity = [2, 4, 2, 7]
      # return 4
      
      # Constraints:
      # 1 <= n == len(apples) <= 50
      # 1 <= m == len(box_capacity) <= 50
      # 1 <= apples[i], box_capacity[i] <= 50
      # Redistribution is always possible with the given constraints.
  
output: def min_boxes_needed(apples: List[int], box_capacity: List[int]) -> int:
      apples.sort(reverse=True)
      box_capacity.sort(reverse=True)
      box_index = 0
      for apple in apples:
          while apple > 0 and box_index < len(box_capacity):
              if box_capacity[box_index] >= apple:
                  box_capacity[box_index] -= apple
                  break
              else:
                  apple -= box_capacity[box_index]
                  box_index += 1
          if box_index >= len(box_capacity):
              return len(box_capacity)
      return box_index + 1