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