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