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