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