#include <bits/stdc++.h>
int main() {
  unsigned long int n, m;
  unsigned long int* a = NULL;
  int i;
  unsigned long int comb_num = 0;
  scanf("%lu", &n);
  scanf("%lu", &m);
  a = (unsigned long int*)malloc(sizeof(unsigned long int) * n);
  for (i = 0; i < n; i++) {
    scanf("%lu", &a[i]);
  }
  int l = 0, r = 0;
  for (l = 0; l < n; l++) {
    unsigned long int sum = 0;
    for (r = l; r < n; r++) {
      sum += a[r];
      if (sum % m == 0) {
        comb_num++;
      }
    }
  }
  printf("%lu\n", comb_num);
  return 0;
}
