Juan José is organizing an exciting hiking trip and plans to take a group of $$$K$$$ people with him. Each person $$$i$$$ has a backpack with a fixed capacity of $$$B_i$$$ units of weight. The goal is to carry provisions for the trip, but Juan José wants to do it efficiently and maximize the total number of the provisions carried by the group.
Juan José has a list of $$$M$$$ different provisions. Each provision $$$i$$$ has a weight $$$W_i$$$. The weight of a provision represents the amount of space it occupies in the backpack. The backpack capacities are given in an array of size $$$K$$$, where the $$$i$$$-th element ($$$K_i$$$) represents the capacity of the backpack for person $$$i$$$. Juan José needs to decide how to distribute the provisions among the people's backpacks in a way that maximizes the total number of provisions carried by the group and complies with the backpacks' capacity constraints.
Since Juan José is a skilled programmer, he needs your help to write a program that finds the optimal distribution of provisions to maximize the total value.
The first line of input will contain two integers separated by a space: $$$K$$$ $$$(1 \leq K \leq 15)$$$, the number of people in the group, and $$$M$$$ $$$(1 \leq M \leq 15)$$$, the number of available provisions.
The following line will contain $$$K$$$ integers $$$K_i$$$ $$$(1 \leq K_i \leq 15)$$$ separated by spaces, representing the backpack capacities for each person in the group.
The following line will contain $$$M$$$ integers $$$M_i$$$ $$$(1 \leq M_i \leq 15)$$$ separated by spaces, representing the weights of each provision.
You should print a single integer that represents the maximum total of provisions that the group can carry on the hiking trip without exceeding the capacity of anyone's backpack.
3 33 5 101 3 3
3
2 31 12 2 2
0
2 55 51 4 2 5 3
4