#include <bits/stdc++.h>
int main() {
  unsigned long n, m, l, r;
  unsigned long A[100001] = {0};
  scanf("%ld %ld", &n, &m);
  for (unsigned long i = 0; i < n; i++) {
    scanf("%ld", &A[i]);
  }
  unsigned long ans = 0;
  unsigned long sum = 0;
  for (unsigned long i = 1; i <= n; i++) {
    for (unsigned long j = 1; j <= i; j++) {
      sum = 0;
      for (unsigned long k = j; k <= i; k++) {
        sum += A[k];
      }
      if (sum % m == 0) ans++;
    }
  }
  printf("%ld\n", ans);
  return 0;
}
