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