#include <bits/stdc++.h>
long sum[100001] = {0};
template <typename T>
inline void in(T &opt) {
  char ch = getchar();
  opt = 0;
  while (!isdigit(ch)) {
    ch = getchar();
  }
  while (isdigit(ch)) {
    opt = (opt << 3) + (opt << 1) + ch - '0';
    ch = getchar();
  }
}
int main() {
  size_t count, ans = 0;
  int mod;
  in(count);
  in(mod);
  for (unsigned int i = 1; i <= count; i++) {
    int tmp = 0;
    in(tmp);
    sum[i] = sum[i - 1] + tmp;
  }
  for (unsigned int begin = 1; begin <= count; begin++) {
    for (unsigned int length = 0; begin + length <= count; length++) {
      if ((sum[begin + length] - sum[begin - 1]) % mod == 0) {
        ans++;
      }
    }
  }
  printf("%d", ans);
  return 0;
}
