#include <bits/stdc++.h>
using namespace std;
void solve4() {
  int N_MAX = 100000;
  int N, M, A[N_MAX];
  cin >> N >> M;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    A[i] %= M;
  }
  long long ans = 0;
  int sum = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      sum += A[j];
      if (sum % M == 0) {
        ans++;
      }
    }
    sum = 0;
  }
  cout << ans << '\n';
}
int main() {
  solve4();
  return 0;
}
