#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n;
long long m, x[maxn], qzh[maxn], ans;
bool fuck[maxn];
inline void gi(long long &x) {
  char c;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    ;
  for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
int main() {
  scanf("%d%lld", &n, &m);
  for (register int i = 1; i <= n; i++) {
    gi(x[i]);
    qzh[i] = qzh[i - 1] + x[i];
  }
  long long cnt;
  for (register int i = 1; i <= n; i++)
    if (!fuck[i - 1]) {
      cnt = 0;
      for (register int j = i; j <= n; j++)
        if (!fuck[j]) {
          if (!((qzh[j] - qzh[i - 1]) % m)) {
            cnt++;
            fuck[j] = 1;
          }
        }
      ans += cnt * (cnt + 1) >> 1;
    }
  printf("%lld", ans);
  return 0;
}
