#include <bits/stdc++.h>
using namespace std;
const int infi = numeric_limits<int>::max();
const double eps = 0;
const int ms = 0;
vector<long long> S;
long long sum(int i) { return S[i]; }
long long sum(int l, int r) {
  long long L;
  if (l == 0) return S[r];
  return S[r] - S[l - 1];
}
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> A(N);
  S = vector<long long>(N);
  long long s = 0;
  for (int n = 0; n < N; n++) {
    cin >> A[n];
    s += A[n];
    S[n] = s;
  }
  long long ans = 0;
  for (int r = 0; r < N; r++) {
    for (int l = 0; l <= r; l++) {
      if (sum(l, r) % M == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
