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