#include <bits/stdc++.h>
const int N = 1e5 + 50;
const int mod = 1e9 + 7;
using namespace std;
int n, m;
int x;
long long ans = 0;
long long sum[N];
int read() {
  int s = 0, t = 1;
  char c;
  while (c < '0' || c > '9') {
    if (c == '-') t = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    s = s * 10 + c - '0';
    c = getchar();
  }
  return s * t;
}
long long readl() {
  long long s = 0, t = 1;
  char c;
  while (c < '0' || c > '9') {
    if (c == '-') t = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    s = s * 10 + c - '0';
    c = getchar();
  }
  return s * t;
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) x = read(), sum[i] = sum[i - 1] + x;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if ((sum[j] - sum[i - 1]) % m == 0) ans++;
  printf("%lld", ans);
  return 0;
}
