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