#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<long long> S;
int main(void) {
  cin >> N >> M;
  S.resize(N + 1);
  S[0] = (long long)0;
  for (int i = 1; i <= N; ++i) {
    long long a;
    cin >> a;
    S[i] = a + S[i - 1];
  }
  long long ans = (long long)0;
  for (int l = 1; l <= N; ++l) {
    for (int r = l; r <= N; ++r) {
      long long sum = S[r] - S[l - 1];
      if (sum % M == 0) ++ans;
    }
  }
  cout << ans << '\n';
  return 0;
}
