#include <bits/stdc++.h>
using namespace std;
template <class t, class u>
void chmax(t& a, u b) {
  if (a < b) a = b;
}
template <class t, class u>
void chmin(t& a, u b) {
  if (b < a) a = b;
}
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;
using vi = vc<int>;
const ll mod = 1e9 + 7;
const ll INF = 1e18;
int main() {
  int n, m;
  cin >> n >> m;
  vector<ll> a(n);
  vector<ll> b(n, 0);
  for (ll i = 0; i < (ll)(n); ++i) {
    cin >> a[i];
    if (i == 0)
      b[i] = a[i] % m;
    else
      b[i] = (b[i - 1] + a[i]) % m;
  }
  ll ans = 0;
  for (ll i = 0; i < (ll)(n); ++i) {
    for (ll j = i; j < n; j++) {
      if (i == j) {
        if (b[i] == 0) ans++;
      } else if ((b[j] - b[i]) % m == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
