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