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