#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> B;
  long long total = 0;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    total += tmp;
    B.push_back(total);
  }
  long long count = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      long long total = (i == 0) ? B[j] : B[j] - B[i - 1];
      if (total % M == 0) count++;
    }
  }
  cout << count << endl;
  return 0;
}
