#include <bits/stdc++.h>
using namespace std;
long long a[110000];
long long sum[110000];
int main() {
  long long n, m;
  long long cnt = 0;
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sum[0] = 0;
  for (long long i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j < i; j++)
      if ((sum[i] - sum[j]) % m == 0) cnt++;
  }
  printf("%lld\n", cnt);
  return 0;
}
