Problem2308--At Most 3 (Judge ver.)

2308: At Most 3 (Judge ver.)

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Problem Statement

There are NN weights called Weight 11, Weight 22\dots, Weight NN. Weight ii has a mass of A_iAi.
Let us say a positive integer nn is a good integer if the following condition is satisfied:
  • We can choose at most 33 different weights so that they have a total mass of nn.
How many positive integers less than or equal to WW are good integers?

Constraints

  • 1 \leq N \leq 3001N300
  • 1 \leq W \leq 10^61W106
  • 1 \leq A_i \leq 10^61Ai106
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:
NNWWA_1A1A_2A2\dotsA_NAN

Output

Print the answer.

Sample Input Copy

2 10
1 3

Sample Output Copy

3

HINT

If we choose only Weight 11, it has a total mass of 11, so 11 is a good integer.
If we choose only Weight 22, it has a total mass of 33, so 33 is a good integer.
If we choose Weights 11 and 22, they have a total mass of 44, so 44 is a good integer.
No other integer is a good integer. Also, all of 1133, and 44 are integers less than or equal to WW. Therefore, the answer is 33.

Source/Category