#include <bits/stdc++.h>
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = long long;
using P = pair<ll, ll>;
ll INF = 1000000007;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  vi a(n);
  for (int64_t i = 0; i < (int64_t)(n); i++) cin >> a.at(i);
  vi csum(n);
  csum.at(0) = a.at(0);
  for (ll i = 1; i < n; i++) csum.at(i) = csum.at(i - 1) + a.at(i);
  ll res = 0;
  for (int64_t l = 0; l < (int64_t)(n); l++) {
    for (ll r = l; r < n; r++) {
      ll lsum = l >= 1 ? csum.at(l - 1) : 0;
      ll rsum = csum.at(r);
      if ((rsum - lsum) % m == 0) {
        res++;
        cerr << "l:" << l << " r:" << r << endl;
      }
    }
  }
  cout << res << endl;
}
