
Yangyang loves AC 
Time Limit: 2000ms, Special Time Limit:5000ms, Memory Limit:65536KB 
Total submit users: 32, Accepted users: 14 
Problem 11560 :
No special judgement

Problem description 
Yangyang takes part in the ACM Summer Training. She loves AC, but there is so much knowledge to learn, For example, Dynamic Programming, Greedy, Search, Graph, Data Structure, and so on. So she decides to ask some other ACMers for help. There are some details below:
There are M (1 <= M <= 20000) ACMers. As we know, ACMers are always busy, so she decides to ask each ACMer at most once.
After being helped, Yangyang will fell happy, The ith ACMer will bring her Hi(1 <= Hi <= 2^13)Happiness. Moreover, Yangyang prefer to numbers that are power of 2, (that is to say, only 1, 2, 4, 8, 16 … 2^13 are valid value of the happiness)
Summer Training has N (1 <= N <= 20000) days. Yangyang have a threshold of happiness Ti (1 <= Ti <= 20000) at the ith day. If the total happiness of the day is greater than or equal to Ti, this day will be a happy day for her. Yangyang wants to maximize the number of happy days, but she doesn’t know how to achieve the idea, so again she come to ask you for help, can you make her happy?

Input 
There are multiple test cases.
In each test case, the first line contains two postive integers N,M, separated by a space, where N indicates the number of days, and M indicates the number of ACMers
The following N lines, each will contain a integer, the ith integer indicates the threshold of happiness for the ith day.
The following M lines, each will contain a integer, the ith integer indicates the happiness which the ith ACMer will bring to her.

Output 
For each test case ,output an integer, the maximum number of happy days.

Sample Input 
1 2
2
1
1
3 2
1
3
4
2
8

Sample Output 
1
2 
Problem Source 
2014哈尔滨理工大学秋季训练赛

Submit
Discuss
Judge Status
Problems
Ranklist

