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