#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
  int n;
  ll m;
  cin >> n >> m;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<ll> s(n + 1, 0);
  for (int i = 0; i < n; i++) s[i + 1] = s[i] + a[i];
  ll cnt = 0LL;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      if ((s[j] - s[i]) % m == 0LL) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
