#include <bits/stdc++.h>
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T>
void chmin(T& a, const T& b) {
  a = min(a, b);
}
template <class T>
void chmax(T& a, const T& b) {
  a = max(a, b);
}
void yes() {
  cout << "Yes" << endl;
  exit(0);
}
void no() {
  cout << "No" << endl;
  exit(0);
}
int main() {
  int n, m;
  cin >> n >> m;
  vll a(n + 1, 0);
  for (int i = (0); i < (n); ++i) cin >> a[i + 1];
  for (int i = (0); i < (n); ++i) a[i + 1] += a[i];
  ll cnt = 0;
  for (int l = (0); l < (n); ++l) {
    for (int r = (l); r < (n); ++r) {
      if ((a[r + 1] - a[l]) % m == 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
