#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define eps 1e-9
#define INF 2000000000              // 2e9
#define LLINF 2000000000000000000ll // 2e18 (llmax:9e18)
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))

#ifndef LOCAL
#define dmp(...) ;
#else
#define dmp(...)                                                               \
  cerr << "[ " << #__VA_ARGS__ << " ] : " << dump_str(__VA_ARGS__) << endl
#endif

// ---------------- Utility ------------------

template <class T>
bool chmin(T &a, const T &b) {
  if (a <= b) return false;
  a = b;
  return true;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a >= b) return false;
  a = b;
  return true;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;

template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

// ----------------- Input -------------------

template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}

template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}

// ----------------- Output ------------------

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.first << ',' << p.second;
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (const T &e : v) os << e << " ";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const deque<T> &d) {
  for (const T &e : d) os << e << " ";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const set<T> &s) {
  os << "{ ";
  for (const T &e : s) os << e << " ";
  os << "}";
  return os;
}

template <class T>
ostream &operator<<(ostream &os, const multiset<T> &s) {
  os << "{ ";
  for (const T &e : s) os << e << " ";
  os << "}";
  return os;
}

template <class T, class U>
ostream &operator<<(ostream &os, const map<T, U> &m) {
  os << "{ ";
  for (const auto &[key, val] : m) os << "( " << key << " -> " << val << " ) ";
  os << "}";
  return os;
}

void dump_str_rec(ostringstream &) {}

template <class Head, class... Tail>
void dump_str_rec(ostringstream &oss, Head &&head, Tail &&... tail) {
  oss << ", " << head;
  dump_str_rec(oss, forward<Tail>(tail)...);
}

template <class T, class... U>
string dump_str(T &&arg, U &&... args) {
  ostringstream oss;
  oss << arg;
  dump_str_rec(oss, forward<T>(args)...);
  return oss.str();
}

// --------------- Fast I/O ------------------

void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

// ------------ End of template --------------

#define endl "\n"

void solve() {
  int N;
  ll X;
  cin >> N >> X;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) { cin >> A[i]; }
  vector<ll> num(N);
  ll tmp = X;
  for (int i = N - 1; i >= 0; i--) {
    num[i] = tmp / A[i];
    tmp %= A[i];
  }
  auto dp = vect(N, vect(2, 0ll));
  dp[0][0] = 1ll;
  for (int i = 0; i + 1 < N; i++) {
    for (int j = 0; j < 2; j++) {
      if (num[i] + j < A[i + 1] / A[i]) dp[i + 1][0] += dp[i][j];
      if (num[i] + j != 0) { dp[i + 1][1] += dp[i][j]; }
    }
  }
  for (int i = 0; i < N; i++) { dmp(dp[i]); }
  cout << dp[N - 1][1] + dp[N - 1][0] << endl;
  return;
}

int main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _lint = int;
#define REP(i, n) for (_lint i = 0; i < (_lint)(n); i++)
#define FOR(i, a, b) for (_lint i = (_lint)(a); i < (_lint)(b); i++)
#define FORR(i, a, b) for (_lint i = (_lint)(b)-1; i >= (_lint)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))
#define ALL(v) (v).begin(), (v).end()

#define DEBUG(x) cerr << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                                                           \
  {                                                                            \
    cerr << #v << ": ";                                                        \
    REP(__i, size(v)) cerr << ((v)[__i]) << ", ";                              \
    cerr << endl;                                                              \
  }

bool mulge(ll a, ll b, ll t) {
  // a * b >= t
  // a >= ceil(t/b)
  return a >= (t + b - 1) / b;
}

int main() {
  ll x, y, a, b;
  cin >> x >> y >> a >> b;
  ll ex = 0;
  ll st = x;
  while (true) {
    if (mulge(st, a, y)) {
      if (st + b >= y) {
        break;
      } else {
        ll rest = y - st - 1;
        ex += rest / b;
        break;
      }
    } else {
      if (st + b >= y) {
        st *= a;
        ex++;
      } else {
        if (st * a < st + b) {
          st *= a;
          ex++;
        } else {
          ll rest = y - st - 1;
          ex += rest / b;
          break;
        }
      }
    }
  }
  cout << ex << endl;
  return 0;
}
