#include <bits/stdc++.h>
using namespace std;
int main() {
  int N = 13;
  scanf("%d", &N);
  int M = 17;
  scanf("%d", &M);
  std::vector<int> nums(N);
  for (size_t i = 0; i < N; i++) scanf("%d", &(nums[i]));
  std::vector<int> sums(nums.size() + 1, 0);
  for (size_t i = 1; i < sums.size(); i++) sums[i] = sums[i - 1] + nums[i - 1];
  int total = 0;
  for (size_t i = 0; i < sums.size() - 1; i++) {
    for (size_t j = i + 1; j < sums.size(); j++) {
      int nsum = sums[j] - sums[i];
      if (nsum % M == 0) {
        total++;
      }
    }
  }
  cout << total << endl;
  return 0;
}
