#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> a(n);
  vector<long long int> b(1, 0);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    b.push_back(b.back() + a[i]);
  }
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    long long int t = b[i];
    for (long long int k = i + 1; k <= n; k++) {
      if ((b[k] - t) % m == 0) ans++;
    }
  }
  cout << ans << endl;
}
