#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M;
  cin >> N >> M;
  int a[N];
  long long ruiseki[N];
  for (int i = 0; (N) > i; i++) {
    cin >> a[i];
    ruiseki[i] = (i != 0 ? ruiseki[i - 1] : 0) + a[i];
  }
  long long kekka = 0;
  for (int i = 0; (N) > i; i++) {
    for (int j = 0; (N) > j; j++) {
      if (ruiseki[j] % M == 0 && ruiseki[j] > 0) kekka++;
    }
    for (int j = 0; (N) > j; j++) {
      ruiseki[j] -= a[i];
    }
  }
  cout << kekka << endl;
  return 0;
}
