#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
  Int N, M;
  cin >> N >> M;
  vector<Int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  Int count = 0;
  for (int i = 0; i < A.size(); i++) {
    Int sum = 0;
    for (int j = i; j < A.size(); j++) {
      sum += A[j] % M;
      sum = sum % M;
      if (sum == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
}
