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