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