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