#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[N_MAX];
  sum[0] = A[0];
  if (sum[0] == 0) {
    ans++;
  }
  for (int i = 1; i < N; ++i) {
    sum[i] = sum[i - 1] + A[i];
    sum[i] %= M;
    if (sum[i] == 0) {
      ans++;
    }
  }
  for (int i = 0; i < N - 1; ++i) {
    int a = A[i];
    for (int j = i + 1; j < N; ++j) {
      sum[j] += M - a;
      sum[j] %= M;
      if (sum[j] == 0) {
        ans++;
      }
    }
  }
  cout << ans << '\n';
}
int main() {
  solve4();
  return 0;
}
