#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
long int n, m;
long int a[MAX_N];
void solve() {
  long int ans = 0;
  long int tmp = 0;
  for (int from = 0; from < n; from++) {
    tmp = a[from];
    if (tmp % m == 0) ans++;
    for (int to = from + 1; to < n; to++) {
      tmp += a[to];
      if (tmp % m == 0) ans++;
    }
  }
  cout << ans << endl;
  return;
}
int main(void) {
  cin >> n;
  cin >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  solve();
}
