AQT's Lights

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

With Christmas approaching, AQT is making preparations. He has purchased a row of N lights to put on his Christmas tree, the i^{th} light having a brightness value of a_i. AQT can control which lights are on/off and would like the brightness level of the tree (calculated by taking the average of the brightness values of lights that are on) to be exactly K.

How many ways can he achieve this? Since this value can be quite large, find the answer modulo 10^9+7.

Input Specification

The first line contains two integers N and K (1 \leq N,K \leq 500)

The second line contains N space separated integers, a_1,a_2,\dots,a_N (0 \leq a_i \leq 500)

Output Specification

Output a single integer, the number of ways AQT can select lights to attain the target brightness level modulo 10^9+7.

Subtasks

Subtask 1 [10%]

1 \leq N,K,a_i \le 10

Subtask 2 [40%]

1 \leq N,K,a_i \le 50

Subtask 3 [50%]

No further constraints.

Sample Input

4 3
3 2 4 3

Sample Output

7

Sample Explanation

AQT can pick the following 7 combinations of lights (indices are shown intstead of value): (1), (4), (2,3), (1,4), (1,2,3), (2,3,4), (1,2,3,4).


Comments

There are no comments at the moment.