#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e18, N = 2e6 + 3, BASE = 130;
int main() {
  long long int n, k;
  cin >> n >> k;
  vector<int> arr(n), up(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = n - 2; i >= 0; i--) {
    if (arr[i + 1] == 1) {
      up[i] = up[i + 1] + 1;
    } else {
      up[i] = 0;
    }
  }
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    int ind = i;
    long long int p = 1;
    long long int sum = 0;
    int cnt = 0;
    while (ind < n && cnt <= 20) {
      if (p > INF / arr[ind]) {
        break;
      }
      p *= arr[ind];
      sum += arr[ind];
      cnt++;
      if (p % sum == 0 && p / sum == k) {
        ans++;
      }
      if (up[ind]) {
        if (p % k == 0) {
          long long int num = p / k;
          if (sum + 1 <= num && num <= sum + up[ind]) {
            ans++;
          }
        }
      }
      sum += up[ind];
      ind = ind + 1 + up[ind];
    }
  }
  cout << ans;
}
