#include <bits/stdc++.h>
using namespace std;
int main() {
  int 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);
  if (A[0] % M == 0)
    dp[0] = 1;
  else
    dp[0] = 0;
  long long ans = dp[0];
  for (int i = 1; i < N; i++) {
    if (A[i] % M == 0)
      dp[i] = dp[i - 1] + 1;
    else {
      int pos = i;
      long long sum = A[i];
      while (sum % M != 0) {
        pos--;
        if (pos < 0) {
          break;
        }
        sum += A[pos];
      }
      if (pos < 0)
        dp[i] = 0;
      else if (pos == 0)
        dp[i] = 1;
      else {
        dp[i] = dp[pos - 1] + 1;
      }
    }
    ans += dp[i];
  }
  cout << ans << endl;
  return 0;
}
