#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T, typename U>
ostream &operator<<(ostream &s, const pair<T, U> m) {
  cout << "(" << m.first << ", " << m.second << ")";
  return s;
}
template <typename T, typename U>
ostream &operator<<(ostream &s, const map<T, U> m) {
  ll c = 0;
  cout << "{ ";
  for (auto &(i) : (m)) cout << i << (c++ == m.size() - 1 ? " " : ", ");
  cout << "}";
  return s;
}
template <typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
  cout << "{ ";
  for (ll(i) = 0LL; (i) < (ll)(v.size()); (i)++)
    cout << v[i] << (i == v.size() - 1 ? " " : ", ");
  cout << "}";
  return s;
}
template <typename T>
ostream &operator<<(ostream &s, const list<T> &v) {
  ll c = 0;
  cout << "{ ";
  for (auto &(i) : (v)) cout << i << (c++ == v.size() - 1 ? " " : ", ");
  cout << "}";
  return s;
}
int main(void) {
  ll N, M;
  vector<ll> A;
  ll count = 0;
  cin >> N >> M;
  A.resize(N + 1);
  for (ll(i) = (ll)(1); (i) < (ll)(N); (i)++) {
    ll temp;
    cin >> temp;
    A[i] += temp + A[i - 1];
  }
  for (ll(i) = 0LL; (i) < (ll)(A.size()); (i)++) {
    for (ll(j) = (ll)(i + 1); (j) < (ll)(A.size()); (j)++) {
      ll temp = A[j] - A[i];
      if (temp % M == 0) count++;
    }
  }
  cout << count << endl;
  return 0;
}
