#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> sum(n);
  cin >> sum[0];
  for (long long i = (long long)(1); i < (long long)(n); i++) {
    long long t;
    cin >> t;
    sum[i] = sum[i - 1] + t;
  }
  long long res = 0;
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    for (long long j = (long long)(i); j < (long long)(n); j++) {
      if (i == 0) {
        if (sum[j] % m == 0) res++;
      } else {
        if ((sum[j] - sum[i - 1]) % m == 0) res++;
      }
    }
  }
  cout << res << endl;
  return 0;
}
