var n,m,i,j:longint;
a,b:array[0..100000]of qword;
count:int64;
begin 
  read(n,m);
  count:=0;
  for i:=1 to n do read(a[i]);
  b[1]:=a[1];
  b[0]:=0;
  for i:=2 to n do 
	b[i]:=b[i-1]+a[i];
  for i:=1 to n do 
	for j:=i to n do 
	if (b[j]-b[i-1]) mod m=0 then inc(count);
  write(count);
end.

