#include <bits/stdc++.h>
int main(void) {
  int N, M, A[100001], l, r;
  int i;
  long int count, sum;
  scanf("%d %d", &N, &M);
  for (i = 1; i <= N; i++) {
    scanf("%d", &(A[i]));
  }
  for (l = 1; l <= N; l++) {
    for (r = l; r <= N; r++) {
      sum = 0;
      for (i = l; i <= r; i++) {
        sum = sum + A[i];
      }
      if (sum % M == 0) {
        count++;
      }
    }
  }
  printf("%ld\n", count);
  return 0;
}
