太水了,背包DP。
(转载请注明出处:http://www.cnblogs.com/Kalenda/)
const maxn=;
var n,f,i,j,ans,t,tt:longint;
q:array[..] of longint;
a:array[..,..] of longint;
begin
readln(n,f);
for i:= to n do
begin
readln(q[i]);
q[i]:=q[i] mod f;
end;
a[,]:=;
for i:= to n do
for j:= to f do
a[i,j]:=(a[i-,(j-q[i]+f) mod f]+a[i-,j]) mod maxn;
writeln(a[n,]-);
end.