stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	long long n,m,maxn;

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{cout<<m/n;

	return 0;}

	for(long long i=1;i<=m;i++)

	{

		if(m%i==0&&n*i<=m)

		{

		maxn=i;}

		if(n*i>m)break;

	}

	cout<<maxn;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2229792585877959x):
#include<cstdio>

#include<iostream>

#include<fstream>

#include<cmath>

#include<cstring>

#include<algorithm>

using namespace std;

#define Set(a) memset(a,0,sizeof(a))

#define F(i,a,b) for(register int i=a;i<=b;++i)

#define UF(i,a,b) for(register int i=a;i>=b;--i)

#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)

typedef long long LL;

typedef long long ll;

typedef unsigned long long ULL;

typedef unsigned long long ull;

inline int r(int &x)

{

    int f=1;x=0;

    char c=getchar();

    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;

    for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+c-'0';

    return x*=f;

}

inline ll r(ll &x)

{

    ll f=1ll;x=0ll;

    char c=getchar();

    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1ll;

    for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(ll)(c-'0');

    return x*=f;

}

inline ull r(ull &x)

{

    x=0ull;

    char c=getchar();

    for(;!isdigit(c);c=getchar());

    for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(ull)(c-'0');

    return x;

}

typedef pair<int,int> pii;

typedef pair<ll,ll> pll;

#define mp(a,b) make_pair(a,b)

inline int max(int a,int b){return a>b?a:b;}

inline int min(int a,int b){return a<b?a:b;}

const int inf=1<<30;



int m,n;

int main()

{

	r(n),r(m);

	UF(i,m/n,1) if(m%i==0) {printf("%d\n",i);return 0;}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

//#include <ext/rope>

//

//using namespace __gnu_cxx;



#define rep(i,e) for(int i=0;i<(e);i++)

#define rep1(i,e) for(int i=1;i<=(e);i++)

#define repx(i,x,e) for(int i=(x);i<=(e);i++)

#define pii pair<int,int>

#define X first

#define Y second

#define PB push_back

#define MP make_pair

#define mset(var,val) memset(var,val,sizeof(var))

#define scd(a) scanf("%d",&a)

#define scdd(a,b) scanf("%d%d",&a,&b)

#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define IOS ios::sync_with_stdio(false);cin.tie(0)



using namespace std;



//#ifdef local

//    #define dbg(args...) do { cout  << #args << " -> "; err(args); cout << endl;} while (0)

//#else

//    #define dbg(...)

//#endif

//

//void err() {  }

////template<template<typename...> class T, typename t, typename... Args>

////void err(T<t> a, Args... args) { for (auto x: a) cout << x << ' '; err(args...); }

//template<typename T, typename... Args>

//void err(T a, Args... args) { cout << a << ' '; err(args...); }





typedef long long ll;

template <class T>

void test(T a) {

    cout<<a<<endl;

}

template <class T,class T2>

void test(T a,T2 b) {

    cout<<a<<" "<<b<<endl;

}

template <class T,class T2,class T3>

void test(T a,T2 b,T3 c) {

    cout<<a<<" "<<b<<" "<<c<<endl;

}

const int inf = 0x3f3f3f3f;

const ll INF = 0x3f3f3f3f3f3f3f3fLL;

const int mod = 1e9+7;



const int N = 1e5+10;



set<int> s;



void work() {

    int n, m;

    scdd(n, m);

    for(int i = 1; i <= sqrt(m+1); ++i){

        if(m%i == 0){

            s.insert(m/i);

            s.insert(i);

        }

    }

    int x = *(s.lower_bound(n));

    printf("%d\n", m/x);

}





int main() {

#ifdef local

    freopen("in.txt","r",stdin);

//        freopen("out1.txt","w",stdout);

#endif // local

//    IOS;

//    init();

    int t;

//    cin >> t;

//    scd(t);

//    for(; t--;)

        work();

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.0068468826376094x):
#include <bits/stdc++.h>

using namespace std;

long long int m,n,min1;



int main()

{//asddddddddddddddasssss

	cin>>n>>m;

	min1=m/n;

	for(long long int i=min1;i>=1;i--)

	{

		if(m%i!=0) continue;

		if(m/i>=n)

		{

			cout<<i;

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

long long n,m,maxn;



int main()

{

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{printf("%lld",m/n);

	return 0;

	}

	for(long long i=1;i<=m;i++)

	{

		if(i*n>m)break;

		if(m%i==0&&i*n<=m)maxn=i;

		

	}

	printf("%lld",maxn);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.236970602884076x):
#include <bits/stdc++.h>

using namespace std;

long long int m,n,min1;



int main()

{//asddddddddddddddasssss

	cin>>n>>m;

	min1=m/n;

	for(long long int i=min1;i>=1;i--)

	{

		if(m%i!=0) continue;

		if(m/i>=n)

		{

			cout<<i;

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	long long n,m,maxn;

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{cout<<m/n;

	return 0;}

	for(long long i=1;i<=m;i++)

	{

		if(m%i==0&&n*i<=m)

		{

		maxn=i;}

		if(n*i>m)break;

	}

	cout<<maxn;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.218361374304516x):
#include <bits/stdc++.h>

using namespace std;

long long int m,n,min1;



int main()

{//asddddddddddddddasssss

	cin>>n>>m;

	min1=m/n;

	for(long long int i=min1;i>=1;i--)

	{

		if(m%i!=0) continue;

		if(m/i>=n)

		{

			cout<<i;

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

//#include <ext/rope>

//

//using namespace __gnu_cxx;



#define rep(i,e) for(int i=0;i<(e);i++)

#define rep1(i,e) for(int i=1;i<=(e);i++)

#define repx(i,x,e) for(int i=(x);i<=(e);i++)

#define pii pair<int,int>

#define X first

#define Y second

#define PB push_back

#define MP make_pair

#define mset(var,val) memset(var,val,sizeof(var))

#define scd(a) scanf("%d",&a)

#define scdd(a,b) scanf("%d%d",&a,&b)

#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define IOS ios::sync_with_stdio(false);cin.tie(0)



using namespace std;



//#ifdef local

//    #define dbg(args...) do { cout  << #args << " -> "; err(args); cout << endl;} while (0)

//#else

//    #define dbg(...)

//#endif

//

//void err() {  }

////template<template<typename...> class T, typename t, typename... Args>

////void err(T<t> a, Args... args) { for (auto x: a) cout << x << ' '; err(args...); }

//template<typename T, typename... Args>

//void err(T a, Args... args) { cout << a << ' '; err(args...); }





typedef long long ll;

template <class T>

void test(T a) {

    cout<<a<<endl;

}

template <class T,class T2>

void test(T a,T2 b) {

    cout<<a<<" "<<b<<endl;

}

template <class T,class T2,class T3>

void test(T a,T2 b,T3 c) {

    cout<<a<<" "<<b<<" "<<c<<endl;

}

const int inf = 0x3f3f3f3f;

const ll INF = 0x3f3f3f3f3f3f3f3fLL;

const int mod = 1e9+7;



const int N = 1e5+10;



set<int> s;



void work() {

    int n, m;

    scdd(n, m);

    for(int i = 1; i <= sqrt(m+1); ++i){

        if(m%i == 0){

            s.insert(m/i);

            s.insert(i);

        }

    }

    int x = *(s.lower_bound(n));

    printf("%d\n", m/x);

}





int main() {

#ifdef local

    freopen("in.txt","r",stdin);

//        freopen("out1.txt","w",stdout);

#endif // local

//    IOS;

//    init();

    int t;

//    cin >> t;

//    scd(t);

//    for(; t--;)

        work();

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.0068468826376094x):
#include <bits/stdc++.h>

using namespace std;

long long int m,n,min1;

int main()

{

	cin>>n>>m;

	min1=m/n;

	for(long long int i=min1;i>=1;i--)

	{

		if(m%i!=0) continue;

		if(m/i>=n)

		{

			cout<<i;

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

long long n,m,maxn;



int main()

{

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{printf("%lld",m/n);

	return 0;

	}

	for(long long i=1;i<=m;i++)

	{

		if(i*n>m)break;

		if(m%i==0&&i*n<=m)maxn=i;

		

	}

	printf("%lld",maxn);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.236970602884076x):
#include <bits/stdc++.h>

using namespace std;

long long int m,n,min1;

int main()

{

	cin>>n>>m;

	min1=m/n;

	for(long long int i=min1;i>=1;i--)

	{

		if(m%i!=0) continue;

		if(m/i>=n)

		{

			cout<<i;

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	long long n,m,maxn;

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{cout<<m/n;

	return 0;}

	for(long long i=1;i<=m;i++)

	{

		if(m%i==0&&n*i<=m)

		{

		maxn=i;}

		if(n*i>m)break;

	}

	cout<<maxn;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.218361374304516x):
#include <bits/stdc++.h>

using namespace std;

long long int m,n,min1;

int main()

{

	cin>>n>>m;

	min1=m/n;

	for(long long int i=min1;i>=1;i--)

	{

		if(m%i!=0) continue;

		if(m/i>=n)

		{

			cout<<i;

			return 0;

		}

	}

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

//#include <ext/rope>

//

//using namespace __gnu_cxx;



#define rep(i,e) for(int i=0;i<(e);i++)

#define rep1(i,e) for(int i=1;i<=(e);i++)

#define repx(i,x,e) for(int i=(x);i<=(e);i++)

#define pii pair<int,int>

#define X first

#define Y second

#define PB push_back

#define MP make_pair

#define mset(var,val) memset(var,val,sizeof(var))

#define scd(a) scanf("%d",&a)

#define scdd(a,b) scanf("%d%d",&a,&b)

#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define IOS ios::sync_with_stdio(false);cin.tie(0)



using namespace std;



//#ifdef local

//    #define dbg(args...) do { cout  << #args << " -> "; err(args); cout << endl;} while (0)

//#else

//    #define dbg(...)

//#endif

//

//void err() {  }

////template<template<typename...> class T, typename t, typename... Args>

////void err(T<t> a, Args... args) { for (auto x: a) cout << x << ' '; err(args...); }

//template<typename T, typename... Args>

//void err(T a, Args... args) { cout << a << ' '; err(args...); }





typedef long long ll;

template <class T>

void test(T a) {

    cout<<a<<endl;

}

template <class T,class T2>

void test(T a,T2 b) {

    cout<<a<<" "<<b<<endl;

}

template <class T,class T2,class T3>

void test(T a,T2 b,T3 c) {

    cout<<a<<" "<<b<<" "<<c<<endl;

}

const int inf = 0x3f3f3f3f;

const ll INF = 0x3f3f3f3f3f3f3f3fLL;

const int mod = 1e9+7;



const int N = 1e5+10;



set<int> s;



void work() {

    int n, m;

    scdd(n, m);

    for(int i = 1; i <= sqrt(m+1); ++i){

        if(m%i == 0){

            s.insert(m/i);

            s.insert(i);

        }

    }

    int x = *(s.lower_bound(n));

    printf("%d\n", m/x);

}





int main() {

#ifdef local

    freopen("in.txt","r",stdin);

//        freopen("out1.txt","w",stdout);

#endif // local

//    IOS;

//    init();

    int t;

//    cin >> t;

//    scd(t);

//    for(; t--;)

        work();

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 0.9991720673209401x):
#include<iostream>

using namespace std;

int main()

{

	int n,m;

	cin>>n>>m;

	for(int i=m/n;i>=1;i--)

	{

		if(m%i==0)

		{

			int t=m/i;

			if(t>=n)

			{

				cout<<i<<endl;

				break;

			}

		}

	}

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

long long n,m,maxn;



int main()

{

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{printf("%lld",m/n);

	return 0;

	}

	for(long long i=1;i<=m;i++)

	{

		if(i*n>m)break;

		if(m%i==0&&i*n<=m)maxn=i;

		

	}

	printf("%lld",maxn);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.227541640950545x):
#include<iostream>

using namespace std;

int main()

{

	int n,m;

	cin>>n>>m;

	for(int i=m/n;i>=1;i--)

	{

		if(m%i==0)

		{

			int t=m/i;

			if(t>=n)

			{

				cout<<i<<endl;

				break;

			}

		}

	}

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	long long n,m,maxn;

	scanf("%lld%lld",&n,&m);

	if(m%n==0)

	{cout<<m/n;

	return 0;}

	for(long long i=1;i<=m;i++)

	{

		if(m%i==0&&n*i<=m)

		{

		maxn=i;}

		if(n*i>m)break;

	}

	cout<<maxn;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2090742635253133x):
#include<iostream>

using namespace std;

int main()

{

	int n,m;

	cin>>n>>m;

	for(int i=m/n;i>=1;i--)

	{

		if(m%i==0)

		{

			int t=m/i;

			if(t>=n)

			{

				cout<<i<<endl;

				break;

			}

		}

	}

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define chmin(a, b) a=min(a, b)

#define chmax(a, b) a=max(a, b)

#define fs first

#define sc second

#define eb emplace_back

using namespace std;



typedef long long ll;

typedef pair<int, int> P;

typedef tuple<int, int, int> T;



int MOD=1e9+7;

ll INF=1e18;



int dx[]={1, -1, 0, 0};

int dy[]={0, 0, 1, -1};



int main(){

    int n, m; cin>>n>>m;

    bool isprime=true;

    for(int i=2; i*i<=m; i++){

        if(m%i==0) isprime=false;

    }

    if(isprime){

        cout << 1 << endl;

        return 0;

    }



    for(int i=n; i<=m; i++){

        if(m%i==0){

            cout << m/i << endl;

            return 0;

        }

    }

}

// Faster C++ solution for the same problem (measured speedup: 1.632697923349065x):
#include <bits/stdc++.h>

#define chmin(a, b) a=min(a, b)

#define chmax(a, b) a=max(a, b)

#define fs first

#define sc second

#define eb emplace_back

using namespace std;



typedef long long ll;

typedef pair<int, int> P;

typedef tuple<int, int, int> T;



int MOD=1e9+7;

ll INF=1e18;



int dx[]={1, -1, 0, 0};

int dy[]={0, 0, 1, -1};



int main(){

    int n, m; cin>>n>>m;

    for(int i=m/n; ; i--){

        if(m%i==0){

            cout << i << endl;

            return 0;

        }

    }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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



/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

*/



int main(){

    int N, M; cin >> N >> M;



    int ans = 1;

    for(int i=1; i*i<=M; i++){

        if(M%i == 0){

            if(M/i >= N) ans = max(ans, i);

            if(i >= N) ans = max(ans, M/i);

        }

    }



    cout << ans << endl;

}

// Faster C++ solution for the same problem (measured speedup: 0.9678874916203095x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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

 

/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

*/



int main(){

    ll N, M; cin >> N >> M;

    for(ll a=M/N; a>=1; a--){

        if(M%a == 0){

            cout << a << endl;

            return 0;

        }

    }

}
// Slower C++ solution:


#include <iostream>

#include <cstdio>

#include <algorithm>

#include <cstring>

#include <cmath>

 

using namespace std;

int n, m;

int ans;

 

int main()

{

    scanf("%d%d",&n,&m);

    int c = m/n;

    int b = sqrt(m);

    c = min(c, b);

    for (int i = 1; i * i <= m; ++i)

    {

        if (m % i == 0) 

        {

            int i1 = i;

            int i2 = m / i;

            if (i1 <= m / n) ans = max(ans, i1); 

            if (i2 <= m / n) ans = max(ans, i2);

        }

    }

    cout << ans;

}


// Faster C++ solution for the same problem (measured speedup: 0.9576977973843105x):
#include <iostream>

#include <string>

#include <cstring>

#include <cstdio>

#include <map>

#include <set>

#include <queue>

#include <stack>

#include <algorithm>

#include <cstdlib>

#include <cmath>

#include <vector>

#include <iomanip>

#if __cplusplus >= 201103L

#include <unordered_map>

#include <unordered_set>

#endif

#define fi first

#define se second

#define ll long long

#define pb push_back

#define int long long

#define vi vector<int>

#define lowbit(x) x&(-x)

#define pii pair<int,int>

#define umap unordered_map

#define uset unordered_set

#define all(x) x.begin(),x.end()

#define mem(a,b) memset(a,b,sizeof(a))

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);



using namespace std;



const int INF = 0x3f3f3f3f;







signed main() {

	IOS;

#ifdef xiaofan

	freopen("in.txt","r",stdin);

#endif

	int n,m;

	cin>>n>>m;

	for(int i=m/n;i>=1;i--){

		if(m%i==0){

			if(m/i>=n){

				cout<<i<<endl;

				break;

			}

		}

	}

	

	







#ifdef xiaofan

	cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";

#endif

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define Would

#define you

#define please





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);



	int N, M;

	cin >> N >> M;



	int M0 = M;

	int X[40000] = {};

	int Y[10000] = {};

	int dokomade = 0;



	int saidai = sqrt(M);

	for (int i = 2; i < saidai + 1; i++) {

		while (M % i == 0) {

			if (Y[i] == 0) dokomade++;

			Y[i]++;

			X[dokomade] = i;

			M /= i;

		}

	}



	int kotae = 1;



	if (M != 1) {

		dokomade++;

		Y[0]++;

		X[dokomade] = 0;

	}



	if (M0 == 1) co(1);

	else {



		int saidai = 1;



		rep1(i, dokomade) saidai *= (1 + Y[X[i]]);





		for (int i = 0; i < saidai; i++) {

			int kari = 1;



			int karii = i;

			rep(ii, dokomade) {



				if(X[ii + 1] == 0) kari *= pow(M, karii % (1 + Y[X[ii + 1]]));

				else kari *= pow(X[ii + 1], karii % (1 + Y[X[ii + 1]]));

				karii /= (1 + Y[X[ii + 1]]);



			}

			ce(kari);



			if (M0 >= 1ll * N * kari) kotae = max(kotae, kari);

		}





		co(kotae);

	}





	Would you please return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.0961868406098116x):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define Would

#define you

#define please





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);



	int N, M;

	cin >> N >> M;



	int saidai = sqrt(M);



	int kotae = 1;

	for (int i = 1; i < saidai + 1; i++) {

		if (M % i == 0) {

			if (M >= 1ll * N * i) kotae = max(kotae, i);

			if (M >= 1ll * N * (M / i)) kotae = max(kotae, (M / i));

		}

	}

	co(kotae);





	Would you please return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

using ll = int64_t;

using P = pair<ll, ll>;



vector<P> v;

ll ans = 0;

vector<ll> prime;

ll N, M;



void dfs(ll idx, ll now){

    if(idx == v.size()){

        if(M / now >= N) ans = max(ans, now);

        return;

    }

    ll mul = 1;

    for(ll i = 0; i <= v[idx].second; i++){

        dfs(idx + 1, now * mul);

        mul *= v[idx].first;

    }

}



void init(){

    bool po[(ll)1e5 + 1] = {};

    for(ll i = 2; i <= 1e5; i++){

        if(po[i]) continue;

        prime.push_back(i);

        for(ll j = 1; i * j <= 1e5; j++) po[i * j] = 1;

    }

}





int main(){

    init();

    cin >> N >> M;

    ll cpy = M;

    for(auto p : prime){

        ll cnt = 0;

        while(cpy % p == 0){

            cpy /= p;

            cnt++;

        }

        if(cnt) v.push_back(P(p, cnt));

    }

    dfs(0, 1);

    cout << ans << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.8385028806269526x):
#include<bits/stdc++.h>

using namespace std;

int main(){

    int N, M;

    cin >> N >> M;

    int ans = 1;

    for(int i = 1; i * i <= M; i++){

        if(M % i) continue;

        for(int d : {i, M / i}) if(M / d >= N) ans = max(ans, d);

    }

    cout << ans << endl;

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll linf=0x3f3f3f3f3f3f3f3f;

int main() {

#ifdef LOCAL

    freopen("in.txt", "r", stdin);

#endif

    ll a, b;

    while (~scanf("%lld%lld", &a, &b)) {

        ll ans=1;

        for (ll i = 1; i * i <= b; i++) {

            if (b % i == 0) {

                if (i * a <= b) {

                    ll tmp = b/i;

                    if (tmp * a <= b) ans = max(max(i, tmp), ans);

                    else ans = max(ans, i);

                } else {

                    break;

                }

            }

        }

        printf("%lld\n", ans);

    }



}


// Faster C++ solution for the same problem (measured speedup: 0.9150395100738746x):
#include<iostream>

#include<cstdio>

#include<cstring>

using namespace std;

int main()

{

	int n,m;

	scanf("%d%d",&n,&m);

	int k=m/n;

	for(int i=k;i>=1;i--)

	if(m%i==0){

		cout<<i;

		return 0;

	}

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll linf=0x3f3f3f3f3f3f3f3f;

int main() {

#ifdef LOCAL

    freopen("in.txt", "r", stdin);

#endif

    ll a, b;

    while (~scanf("%lld%lld", &a, &b)) {

        ll ans=1;

        for (ll i = 1; i * i <= b; i++) {

            if (b % i == 0) {

                if (i * a <= b) {

                    ll tmp = b/i;

                    if (tmp * a <= b) ans = max(max(i, tmp), ans);

                    else ans = max(ans, i);

                } else {

                    break;

                }

            }

        }

        printf("%lld\n", ans);

    }



}


// Faster C++ solution for the same problem (measured speedup: 0.9079559970909864x):
#include<iostream>

using namespace std;

int main()

{

	int n,m;

	cin>>n>>m;

	for(int i=m/n;i>=1;i--)

	{

		if(m%i==0)

		{

			int t=m/i;

			if(t>=n)

			{

				cout<<i<<endl;

				break;

			}

		}

	}

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	long long n,m,ans=0;

	scanf("%lld%lld",&n,&m);

	if(n>m)

	{

		cout<<"0"<<endl;

		return 0;

	}

	if(m%n==0)

	{

		cout<<m/n<<endl;

		return 0;

	}

	for(long long i=1;i<=m;i++)

	{

		if(m%i==0&&m/i>=n)

		ans=i;

		if(m/i<n) break;

	}

	printf("%lld",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2111187277373074x):
#include<iostream>

using namespace std;

int main()

{

	int n,m;

	cin>>n>>m;

	for(int i=m/n;i>=1;i--)

	{

		if(m%i==0)

		{

			int t=m/i;

			if(t>=n)

			{

				cout<<i<<endl;

				break;

			}

		}

	}

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



int main()

{

    ios::sync_with_stdio(false);

    int n, m, ans = -1;

    cin >> n >> m;

    for (int i = 1; i * i <= m; i++)

    {

        if (m % i == 0)

        {

            if (i <= m / n)

                ans = max(ans, i);

            if (i >= n)

                ans = max(ans, m / i);

        }

    }

    cout << ans << endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 0.977764662803645x):
#include<iostream>

using namespace std;

int main()

{

	int n,m;

	cin>>n>>m;

	for(int i=m/n;i>=1;i--)

	{

		if(m%i==0)

		{

			int t=m/i;

			if(t>=n)

			{

				cout<<i<<endl;

				break;

			}

		}

	}

}