#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
  unsigned long N, M;
  cin >> N >> M;
  vector<unsigned long> v(N, 0);
  vector<unsigned long> s(N + 1, 0);
  for (int i = (0); i < (((int)N)); ++i) {
    cin >> v[i];
    s[i + 1] = s[i] + v[i];
  }
  unsigned long ans = 0;
  for (int i = (0); i < (N); ++i) {
    for (int j = (i); j < (N); ++j) {
      if ((s[j + 1] - s[i]) % M == 0) ans++;
    }
  }
  cout << ans << endl;
}
