#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll nmax = 100000;
ll d[nmax + 1];
int main() {
  ll N, M, a, ct;
  cin >> N >> M;
  for (ll i = 1; i <= N; i++) {
    cin >> a;
    d[i] += d[i - 1] + a;
  }
  for (ll i = 0; i <= N; i++) {
    for (ll j = i + 1; j <= N; j++) {
      if ((d[j] - d[i]) % M == 0) ct++;
    }
  }
  cout << ct << endl;
  return 0;
}
