#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int32_t> sumA = {0};
  int64_t sum = 0;
  for (int64_t n = 0; n < N; ++n) {
    int64_t a;
    cin >> a;
    sum += a;
    sumA.push_back(sum % M);
  }
  int64_t count = 0;
  for (int r = 1; r < N + 1; ++r) {
    for (int l = 0; l < r; ++l) {
      sum = sumA[r] - sumA[l];
      if (sum % M == 0) {
        ++count;
      }
    }
  }
  cout << count << endl;
  return 0;
}
