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