#include <bits/stdc++.h>
long long arr_sum(long long l, long long r, long long *A) {
  long long i, counter = 0;
  for (i = l; i <= r; i++) {
    counter += A[i];
  }
  return counter;
}
int main(void) {
  long long N, M;
  scanf("%lld %lld", &N, &M);
  long long A[N];
  long long i, j, counter = 0;
  for (i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  for (i = 0; i < N; i++) {
    for (j = i; j < N; j++) {
      if (arr_sum(i, j, A) % M == 0) {
        counter++;
      }
    }
  }
  printf("%lld\n", counter);
}
