#include <bits/stdc++.h>
using ll = long long;
int main() {
  ll n, m, a[100001] = {0}, wa[100001] = {0};
  std::cin >> n >> m;
  ll sum = 0;
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
    sum += a[i];
    wa[i + 1] = sum;
  }
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if ((wa[j] - wa[i]) % m == 0) ans++;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
