#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
ll A, M, S[100005];
ll c;
int main() {
  cin.tie(0);
  cin >> N >> M;
  for (int i = (0); i < ((N)); i++) {
    cin >> A;
    S[i + 1] = A + S[i];
  }
  for (int l = (0); l < ((N + 1)); l++) {
    for (int r = (l + 1); r < (N + 1); r++) {
      if ((S[r] - S[l]) % M == 0) c++;
    }
  }
  cout << c << endl;
  return 0;
}
