#include <bits/stdc++.h>
int main() {
  int N, M;
  scanf("%d %d", &N, &M);
  int i, a[N];
  for (i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  int sum = 0, answer = 0;
  int l, r;
  for (r = 1; r <= N; r++) {
    for (l = 1; l <= r; l++) {
      int j;
      for (j = l; j <= r; j++) {
        sum += a[j];
      }
      if (sum % M == 0) {
        answer++;
      }
    }
  }
  printf("%d", answer);
  return 0;
}
