#include <bits/stdc++.h>
int main(void) {
  int n, h;
  scanf("%d%d", &n, &h);
  long long sum[n], ans = 0;
  int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum[i] = a[i] + sum[i - 1];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      if ((sum[j] - sum[i] + a[i]) % h == 0) {
        ans++;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
