39 人解决，50 人已尝试。
56 份提交通过，共有 151 份提交。
4.1 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
People in Silverland use coins. They have coins of value $A_1,A_2,A_3,\ldots,A_n$ Silverland dollar. One day Tony opened his money-box and found there were some coins. He decided to buy a very nice watch in a nearby shop. 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 watch.
You are to write a program which reads $n,m,A_1,A_2,A_3,\ldots,A_n$ and $C_1,C_2,C_3,\ldots,C_n$ corresponding to the number of Tony’s coins of value $A_1,A_2,A_3,\ldots,A_n$ then calculate how many prices (from $1$ to $m$) Tony can pay use these coins.
The first line of test case contains two integers $n$ $(1 \le n \le 100)$, $m$ $(m \le 100~000)$. The second line contains $2n$ integers, denoting $A_1,A_2,A_3,\ldots,A_n,C_1,C_2,C_3,\ldots,C_n$ $(1 \le A_i \le 100~000, 1 \le Ci \le 1000)$.
Output the answer on a single line.
2 5 1 4 2 1