#include <bits/stdc++.h>
int sum(int j, int i, int* A) {
  int l, ANS;
  ANS = 0;
  for (l = j; l <= j + i; l++) {
    ANS = ANS + A[l];
  }
  return ANS;
}
int main() {
  int i, j, N, M;
  int ANS = 0;
  scanf("%d %d", &N, &M);
  int A[N];
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  for (i = 0; i < N; i++) {
    A[i] = A[i] % M;
  }
  for (i = 0; i < N; i++) {
    for (j = 0; j < N - i; j++) {
      if (sum(j, i, A) % M == 0) {
        ANS++;
      }
    }
  }
  printf("%d", ANS);
  return 0;
}
