#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long N, M;
  cin >> N >> M;
  vector<long> A(N);
  vector<long> sum(N);
  cin >> A[0];
  sum[0] = A[0];
  for (int i = 1; i < N; i++) {
    cin >> A[i];
    sum[i] = sum[i - 1] + A[i];
  }
  long ans = 0;
  for (int r = 0; r < N; r++) {
    for (int l = 0; l <= r; l++) {
      if (l == 0) {
        if (sum[r] % M == 0) {
          ans++;
        }
      } else {
        if ((sum[r] - sum[l - 1]) % M == 0) {
          ans++;
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
