#include <bits/stdc++.h>
int sum[100000];
int main(void) {
  int n, m, a[100000];
  long count;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sum[0] = a[0] % m;
  for (int i = 1; i < n; i++) sum[i] = (sum[i - 1] + a[i]) % m;
  count = 0;
  for (int l = 0; l < n; l++)
    for (int r = l; r < n; r++)
      if (sum[r] - sum[l - 1] == 0) count++;
  printf("%ld\n", count);
  return 0;
}
