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