#SDNU1486. Problem_D
Problem_D
Description
SDNU Acmers use coins.They have coins of value silver dollar.
One day Fat ChaoChao opened purse and found there were some coins. He decided to buy a very cooooooool gift in a shop and send it to a girl. He wanted to pay the exact price(without change) and he known the price would not more than m.But he didn't know the exact price of the gift.
You are to write a program which reads and corresponding to the number of coins of value then calculate how many prices(form 1 to ) Tony can pay use these coins.
Format
Input
The input contains several test cases.
The first line of each test case contains two integers .
The second line contains integers, denoting $A_1,A_2,A_3...A_n,C_1,C_2,C_3...C-n (1 \leq A_i \leq 100000,1 \leq C_i \leq 1000)$.
The last test case is followed by two zeros.
Output
For each test case output the answer on a single line.
Samples
3 10
1 2 4 2 1 1
2 5
1 4 2 1
0 0
8
4