With Christmas approaching, AQT is making preparations. He has purchased a row of lights to put on his Christmas tree, the light having a brightness value of . 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 .
How many ways can he achieve this? Since this value can be quite large, find the answer modulo .
Input Specification
The first line contains two integers and
The second line contains space separated integers,
Output Specification
Output a single integer, the number of ways AQT can select lights to attain the target brightness level modulo .
Subtasks
Subtask 1 [10%]
Subtask 2 [40%]
Subtask 3 [50%]
No further constraints.
Sample Input
4 3
3 2 4 3
Sample Output
7
Sample Explanation
AQT can pick the following combinations of lights (indices are shown intstead of value): , , , , , , .
Comments