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