#include<iostream>
using namespace std;

typedef long long ll;
const int N = 2e5 + 10;
const int mod = 1e9 + 7;

int main() {

	int a, b; cin >> a >> b;

	int mx = 0;
	for (int i = 1; i <= b; i++) {
		int cnt = (b / i - (a - 1) / i);
		if (cnt >= 2) {
			mx = max(mx, i);
		}
	}
	cout << mx << endl;

	return 0;
}

#include <bits/stdc++.h>
#define ll long long
#define re register int
#define rl register ll
#define rep(i,a,b) for(re i=(a),i##end=(b);i<=i##end;++i)
#define pre(i,a,b) for(re i=(a),i##end=(b);i>=i##end;--i)
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define cpy(a1,a2) memcpy(a1,a2,sizeof(a2))
using namespace std;

ll a,b,c,d,ans;

inline int rint()
{
    re x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48); ch=getchar();}
    return x*f;
}
inline ll rll()
{
    rl x=0ll,f=1ll; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1ll; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48); ch=getchar();}
    return x*f;
}

signed main()
{
	a=rint(),b=rint(),c=rint(),d=rint();
	
	if(c*d<=b) return printf("-1"),0;
	while(a+ans*b>ans*c*d) ++ans;
	printf("%lld",ans);

    return 0;
}
