#include <bits/stdc++.h>
int main() {
  long long N, M, s = 0, ans = 0;
  scanf("%lld %lld", &N, &M);
  long long A[N];
  long long sum[N + 1];
  sum[0] = 0;
  for (long long i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
    s = (s + A[i]) % M;
    sum[i + 1] = s;
  }
  for (long long i = 1; i <= N; i++) {
    for (long long j = 0; j <= i - 1; j++) {
      if ((sum[i] - sum[j]) % M == 0) ans++;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
