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