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