1494. Coins

单点时限: 2.0 sec

内存限制: 256 MB

People in Silverland use coins. They have coins of value 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 . But he didn’t know the exact price of the watch.

You are to write a program which reads and corresponding to the number of Tony’s coins of value then calculate how many prices (from to ) Tony can pay use these coins.

输入格式

The first line of test case contains two integers , . The second line contains integers, denoting .

输出格式

Output the answer on a single line.

样例

Input
2 5
1 4 2 1
Output
4

34 人解决,43 人已尝试。

51 份提交通过,共有 124 份提交。

4.1 EMB 奖励。

创建: 12 年,5 月前.

修改: 2 年,3 月前.

最后提交: 1 年前.

来源: LouTiancheng

题目标签
DP