#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 int x = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      int sum = 0;
      for (int y = i; y <= j; y++) {
        sum += A[y];
      }
      if (sum % M == 0) {
        x++;
      }
    }
  }
  printf("%ld", x);
  return 0;
}
