#include <bits/stdc++.h>
int main(void) {
  long N, M, l, r, i;
  uint64_t sum = 0, check = 0;
  scanf("%d %d", &N, &M);
  long A[N];
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  for (l = 0; l < N; l++) {
    for (r = l; r < N; r++) {
      sum = 0;
      for (i = l; i <= r; i++) {
        sum += A[i];
      }
      if (sum % M == 0) {
        check++;
      }
    }
  }
  printf("%llu", check);
}
