beecrowd | 2938


By Francisco Elio Parente Arcos Filho, UEA BR Brazil

Timelimit: 1

Jaçanã is a bird found in the Amazon region and commonly seen looking for food on the royal-victories that are aquatic plants typical of that region as well. These have a large, circle-shaped leaf with raised edges that lies on the surface of the water and can reach up to 2,5 meters in diameter and withstand up to 40 kilograms.


One day, a broken-wing Jaçanã wanted to carry a number of insects she had collected to eat from the left margin of an igarapé to the right margin. For this he decided to jump with his food in the beak through a path of royal-victories that lined up between one margin and another. However, the royal-victories had varied sizes, so they held different weights. Then, whenever the jaçanã jumped into a leaf that held less weight than it carried, he had to leave some of his food where it was before jumping. Otherwise, it would sink when landing on the next floor.

Note that depending on the capacity of the royal-victories on the path, the bird may not even have reached the right margin. However, it is his nature to go forward in any situation, never going back and always trying to bring as much food to the other margin.

Their task is, given the weight of the jaçanã, the weight of their amount of insects, and the capacities of royal-victories from left to right, to tell in how many royal-victory leaves the bird left some of its food.


The first line of the input contains three integers: P (1 ≤ P ≤ 20000), C (1 ≤ C ≤ 20000) and N (1 ≤ N ≤ 100). Representing respectively the weight of the bird and the weight of the food it carries. Both given in grams. And the amount of royal-victories leaves lined up between the shores. The next line contains N integers V (1 ≤ V ≤ 40000) separated by a single space. Representing the weights in grams that the leaves of royal-victories, from left to right, support without sinking.


The output is a single integer representing the number of leaves of regal victories that were left with some gram of food at the end of the journey of the jaçanã.

Input Samples Output Samples

5000 1200 5
6100 5750 5500 5200 5050


800 300 4
1200 1000 2000 900


800 300 4
1050 1000 2000 900


800 300 10
1063 1075 1050 2000 1000 1024 989 900 961 932


1000 500 7
1400 1200 1123 1000 1000 400 100