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