#ABC251B. [ABC251B] At Most 3 (Judge ver.)

[ABC251B] At Most 3 (Judge ver.)

Score : 200200 points

Problem Statement

There are NN weights called Weight 11, Weight 22, \dots, Weight NN. Weight ii has a mass of AiA_i. Let us say a positive integer nn is a good integer if the following condition is satisfied:

  • We can choose at most 3 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

  • 1N3001 \leq N \leq 300
  • 1W1061 \leq W \leq 10^6
  • 1Ai1061 \leq A_i \leq 10^6
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN WW

A1A_1 A2A_2 \dots ANA_N

Output

Print the answer.

2 10
1 3
3

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 11, 33, and 44 are integers less than or equal to WW. Therefore, the answer is 33.

2 1
2 3
0

There are no good integers less than or equal to WW.

4 12
3 3 3 3
3

There are 33 good integers: 3,63, 6, and 99. For example, if we choose Weights 11, 22, and 33, they have a total mass of 99, so 99 is a good integer. Note that 1212 is not a good integer.

7 251
202 20 5 1 4 2 100
48