#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<long long> sum(n + 1, 0);
  for (long long i = 1; i < n + 1; i++) sum[i] = sum[i - 1] + a[i - 1];
  long long debug = 0;
  ;
  long long ans = 0;
  for (long long i = 0; i < n + 1; i++)
    for (long long j = i + 1; j < n + 1; j++) {
      if ((sum[j] - sum[i]) % m) continue;
      ans++;
    }
  cout << ans << endl;
  ;
}
