#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;
  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
    sum += a[i];
    wa[i + 1] = sum;
    if (a[i] % m == 0) ans++;
    if (sum % m == 0 && i != 0) ans++;
  }
  for (int i = 1; i < n; ++i) {
    ll wai = wa[i];
    for (int j = i + 2; j <= n; ++j) {
      if ((wa[j] - wai) % m != 0) continue;
      ans++;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
