#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M;
  long long ans = 0;
  scanf("%d%d", &N, &M);
  vector<long long> A(N), S(N + 1);
  for (int i = 0; i < N; i++) scanf("%lld", &A[i]);
  S[0] = 0;
  for (int i = 1; i < N + 1; i++) S[i] = S[i - 1] + A[i - 1];
  for (int l = 0; l < N; l++) {
    for (int r = l + 1; r < N + 1; r++) {
      if ((S[r] - S[l]) % M == 0) ans++;
    }
  }
  printf("%lld", ans);
  return 0;
}
