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