#include <bits/stdc++.h>
long long v[100000 + 1];
long long s[100000 + 6];
int main() {
  long long n, m, a, rez = 0;
  std::cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    std::cin >> a;
    v[i] = a % m;
    s[i] = s[i - 1] + v[i];
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) {
      if ((s[j] - s[i - 1]) % m == 0) rez++;
    }
  std::cout << rez;
  return 0;
}
