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