#include <bits/stdc++.h>
int main(void) {
  long N, M, i, j, k, count = 0, tot;
  long a[100000];
  scanf("%ld %ld", &N, &M);
  for (i = 0; i < N; i++) scanf("%ld", &a[i]);
  for (j = 0; j < N; j++) {
    tot = a[j] % M;
    if (tot == 0) count++;
    for (k = j + 1; k < N; k++) {
      tot = (tot + a[k]) % M;
      if (tot == 0) count++;
    }
  }
  printf("%ld\n", count);
  return 0;
}
