#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long N, M;
  cin >> N >> M;
  vector<long> A(N + 1, 0), sums(N + 1, 0);
  for (long i = 1; i <= N; ++i) {
    long a;
    cin >> a;
    A[i] = a;
    sums[i] += sums[i - 1] + a;
  }
  long ans = 0;
  for (long i = 1; i <= N; ++i) {
    for (long j = i; j <= N; ++j) {
      if ((sums[j] - sums[i - 1]) % M == 0) {
        ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
