#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]);
    if (a[i] % m == 0) {
      comb_num++;
    }
  }
  int l = 0, r = 0;
  unsigned long int sum[n][n];
  sum[0][0] = a[0];
  for (r = 1; r < n; r++) {
    sum[0][r] = a[r] + sum[0][r - 1];
    if (sum[0][r] % m == 0) comb_num++;
  }
  for (l = 1; l < n; l++) {
    for (r = l + 1; r < n; r++) {
      sum[l][r] = sum[l - 1][r] - a[l - 1];
      if (sum[l][r] % m == 0) comb_num++;
    }
  }
  printf("%lu\n", comb_num);
  return 0;
}
