#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
using ll = long long;
int main(int argc, char const *argv[]) {
  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  for (auto &&i : a) {
    cin >> i;
  }
  vector<ll> ruiseki(n + 1, 0);
  for (int i = 1; i < n + 1; i++) {
    ruiseki[i] = ruiseki[i - 1] + a[i - 1];
  }
  int right = 1;
  int left = 1;
  int ans = 0;
  for (int i = 1; i < n + 1; i++) {
    right = i;
    left = 0;
    for (int l = left; l < right; l++) {
      if ((ruiseki[right - 1] - ruiseki[l - 1]) % m == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
