#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  ll n, m;
  cin >> n >> m;
  ll a[n];
  for (ll i = ll(0); i < ll(n); i++) cin >> a[i];
  ll ans = 0;
  ll sum = 0;
  for (ll i = ll(0); i < ll(n); i++) {
    for (ll j = ll(i); j < ll(n); j++) {
      sum += a[j];
      if (sum % m == 0 && sum >= m) ans++;
    }
    sum = 0;
  }
  cout << ans;
}
