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