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