#include <bits/stdc++.h>
int main() {
  int N, M;
  long long int *A;
  long long int *dif;
  int width;
  int i;
  long long int sum;
  long long int ans;
  scanf("%d %d", &N, &M);
  A = (long long int *)malloc(sizeof(long long int) * N);
  dif = (long long int *)malloc(sizeof(long long int) * N);
  for (i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  ans = 0;
  for (width = 0; width < N; width++) {
    for (i = 0; i < N - width - 1; i++) {
      dif[i] = A[i + width + 1] - A[i];
    }
    sum = 0;
    for (i = 0; i < width + 1; i++) {
      sum = sum + A[i];
    }
    for (i = 0; i < N - width; i++) {
      if (sum % M == 0) {
        ans++;
      } else {
      }
      if (i != N - width - 1) {
        sum = sum + dif[i];
      }
    }
  }
  printf("%lld\n", ans);
  free(dif);
  free(A);
  return 0;
}
