#include <bits/stdc++.h>
int main(void) {
  long int sum;
  int i, j, patterns = 0;
  int size, children;
  int box[100000];
  scanf("%d %d", &size, &children);
  for (i = 0; i < size; i++) {
    scanf("%d", &box[i]);
  }
  for (i = 0; i < size; i++) {
    sum = 0;
    for (j = i; j < size; j++) {
      sum += box[j] % children;
      if (sum % children == 0) {
        patterns++;
      }
    }
  }
  printf("%d", patterns);
  return 0;
}
