#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, M;
  cin >> N >> M;
  vector<long long> A(N);
  vector<long long> sum(N + 1);
  sum[0] = 0;
  for (int i = 0; i < (N); i++) {
    cin >> A[i];
    sum[i + 1] = sum[i] + A[i];
  }
  long long res = 0;
  for (int l = 0; l < N; l++) {
    for (int r = l + 1; r <= N; r++) {
      if ((sum[r] - sum[l]) % M == 0) {
        res++;
      }
    }
  }
  cout << res << "\n";
  return 0;
}
