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