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