#include <bits/stdc++.h>
using namespace std;
using ll = long long;
namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
}  // namespace NS
ll N, M;
int64_t ans = 0;
vector<ll> A;
int main() {
  cin >> N >> M;
  A.resize(N + 5);
  ll sum = 0, ipt;
  for (ll i = 0; i <= N; ++i) {
    A[i] = sum;
    if (i == N) {
      break;
    }
    cin >> ipt;
    sum += ipt;
  }
  ll tmp;
  for (ll left = 0; left < N; ++left) {
    for (ll right = left + 1; right <= N; ++right) {
      tmp = A[right] - A[left];
      if (tmp % M == 0) {
        ++ans;
      }
    }
  }
  cout << ans << endl;
}
