#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int N, M;
  ll cnt = 0;
  cin >> N >> M;
  vector<int> A(N);
  vector<ll> S(N + 1, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    S[i + 1] = S[i] + A[i];
  }
  for (int l = 0; l < N; l++) {
    for (int r = l; r < N; r++) {
      if ((S[r + 1] - S[l]) % M == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  cin >> cnt;
  return 0;
}
