#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int main() {
  int N, M;
  int A[100010];
  cin >> N >> M;
  ll ans = 0;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  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;
}
