#include <bits/stdc++.h>
int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);
  long long A[N];
  int i, j, temp;
  long long ans = 0;
  scanf("%lld", &A[0]);
  for (i = 1; i < N; i++) {
    scanf("%d", &temp);
    A[i] = A[i - 1] + temp;
  }
  long long difference;
  for (i = 0; i < N; i++) {
    for (j = 0; j <= i; j++) {
      if (j - 1 < 0) {
        difference = A[i];
      } else {
        difference = A[i] - A[j - 1];
      }
      if (difference % M == 0) {
        ans++;
      }
    }
  }
  printf("%lld", ans);
  return 0;
}
