#include <bits/stdc++.h>
int main(void) {
  int N, M, l, r;
  int i;
  long int count, sum, A[100001], B[100001];
  scanf("%d %d", &N, &M);
  B[0] = 0;
  for (i = 1; i <= N; i++) {
    scanf("%ld", &(A[i]));
    B[i] = B[i - 1] + A[i];
  }
  for (l = 1; l <= N; l++) {
    for (r = l; r <= N; r++) {
      if (B[l - 1] % M == B[r] % M) {
        count++;
      }
    }
  }
  printf("%ld\n", count);
  return 0;
}
