#include <bits/stdc++.h>
int sum(int i, int j, int a[]) {
  int sum = 0;
  for (int k = i; k <= j; k++) {
    sum += a[k - 1];
  }
  return sum;
}
int main(void) {
  int i, j, a, b = 0;
  int count = 0;
  scanf("%d%d\n", &i, &j);
  int array[i];
  for (b = 0; b < i; b++) {
    scanf("%d", &a);
    array[b] = a;
  }
  for (int l = 1; l <= i; l++) {
    for (int r = l; r <= i; r++) {
      if (sum(l, r, array) % j == 0) {
        count++;
      }
    }
  }
  printf("%d", count);
}
