#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> A(N);
  long long sub = 0;
  vector<long long> sum;
  for (long long i = 0; i < N; i++) {
    cin >> sub;
    A[i] = sub % M;
    if (i == 0) {
      sum.push_back(A[0]);
    } else {
      sum.push_back(A[i] + sum[i - 1]);
    }
  }
  long long answer = 0;
  for (long long i = 0; i < N; i++) {
    for (long long j = i; j < N; j++) {
      long long subsub = (i == 0) ? sum[j] : (sum[j] - sum[i - 1]);
      if (subsub % M == 0) {
        answer++;
      }
    }
  }
  cout << answer << endl;
}
