LCC '23 Contest 3 J3 - Snowball Making

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

After unwrapping their presents, Elsa and Anna decide to head outside and enjoy winter in the most classic way possible: having a snowball fight.

To prepare, they have to make their snow forts, and prepare some ammunition (snowballs).

To ensure maximum damage, Anna decides to make snowballs that are each of size M. Elsa has provided N smaller snowballs for her, each of size N_i, which she wants to make snowballs of size M out of. She will do this by combining two snowballs. The resulting snowball will have a size equivalent to the sum of the sizes of the two smaller snowballs.

However, Anna isn't very bright, She does not know it is possible to add more than 2 numbers together. As a result, she will only combine 2 snowballs if they directly result in a snowball of size M.

For example, if Anna wants to make snowballs of size 10, she knows that snowballs of size 4 and 6 can add up to a snowball of size 10, so she will combine them, but she does not know that you can add snowballs of size 2, 2, and 6 together to also obtain of snowball of size 10, so she will not combine them.

Can you help Anna determine how many snowballs of size M can she can obtain?

Constraints

1 \le N \le 10^5

1 \le N_i \le M \le 10^6

Input Specification

The first line will contain two integers, N and M.

The next line will contain N integers, N_i.

Output Specification

Output the number of snowballs of size M that Anna can make.

Sample Input

10 10
2 2 6 4 2 10 8 2 2 2

Sample Output

3

Sample Output Explanation

Anna will combine the following snowballs:

2 + 8 = 10

6 + 4 = 10

10 = 10

Anna does not combine 2 + 2 + 2 + 2 + 2 since she doesn't know it adds up to 10.


Comments

There are no comments at the moment.