#include <bits/stdc++.h>
int main(void) {
  long long n, m, a[100000], k, ans;
  int i, j, y;
  ans = 0;
  scanf("%lld", &n);
  scanf("%lld", &m);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j < n - i + 1; j++) {
      k = 0;
      for (y = 0; y <= i - 1; y++) {
        k = k + a[j + y];
        k = k % m;
      }
      if (k == 0) ans++;
    }
  }
  printf("%lld", ans);
  return 0;
}
