#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long n, m, count = 0;
  cin >> n >> m;
  vector<long long> a(n), sum(n + 1);
  sum[0] = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum[i + 1] = sum[i] + a[i];
  }
  for (int left = 0; left < n; ++left) {
    for (int right = left; right < n; ++right) {
      if ((sum[right + 1] - sum[left]) % m == 0) ++count;
    }
  }
  cout << count << endl;
}
