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