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