#P2946. [USACO09MAR] Cow Frisbee Team S

[USACO09MAR] Cow Frisbee Team S

Description

Lao Tang has recently gotten into frisbee, and John wants to play with him, so he plans to select a team from his NN cows.

Each cow has an integer ability. The ii-th cow’s ability is RiR_i. The number of players on the frisbee team must be between 11 and NN inclusive. A team’s total ability is the sum of the abilities of all its members.

John is superstitious, and his lucky number is FF, so he requires the team’s total ability to be a multiple of FF. Please compute how many team selections satisfy this requirement. Since this number can be very large, output the answer modulo 10810^8.

Input Format

The first line contains two space-separated integers: NN and FF.

Lines 22 through N+1N+1: line i+1i+1 contains an integer RiR_i, the ability of the ii-th cow.

Output Format

A single integer: the number of valid selections modulo 10810^8.

4 5 
1 
2 
8 
2 

3 

Hint

For 100%100\% of the testdata, 1N20001 \le N \le 2000, 1F10001 \le F \le 1000, 1Ri1051 \le R_i \le 10^5.

Translated by ChatGPT 5