#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
using iii = pair<int, ii>;
using viii = vector<iii>;
using ll = long long int;
using vc = vector<char>;
using vb = vector<bool>;
using ib = pair<int, bool>;
using vib = vector<ib>;
bool resuelveCaso() {
  int n;
  cin >> n;
  if (!cin) return false;
  int m;
  cin >> m;
  ll acum = 0;
  vector<ll> v(n);
  for (int i = 0; i < n; ++i) {
    ll aux;
    cin >> aux;
    acum += aux;
    v[i] = acum;
  }
  ll res = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      ll sol;
      if (i == 0)
        sol = v[j];
      else
        sol = v[j] - v[i - 1];
      if (sol % m == 0) ++res;
    }
  }
  cout << res << '\n';
  return true;
}
int main() {
  while (resuelveCaso()) {
  }
  return 0;
}
