stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

typedef long long ll;





std::vector<ll> enum_div(ll n);



int main() {



    ll N, M;



    cin >> N >> M;



    vector<ll> v = enum_div(M);



    sort(v.begin(), v.end(), greater<ll>());



    ll ans = 1;



    for (ll i = 0; i < v.size(); i++) {

        if (v[i] * N <= M) {

            ans = v[i];

            break;

        }

        

    }





    cout << ans << '\n';



}



std::vector<ll> enum_div(ll n)//nの約数を列挙

{

    vector<ll> ret;

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



        if (n % i == 0) {



            ret.push_back(i);



            if (i * i != n) {

                ret.push_back(n / i);

            }

        }

    }

    

    return ret;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

int main(){int N,M,i;scanf("%d%d",&N,&M);for (i=M/N;i>=1;i--){if((M-i*N)%i==0){printf("%d\n",i);break;}}}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;









int main() {



    int N, M;



    cin >> N >> M;



    int start = M / N;

    int ans = 1;



    for (int i = start; i >= 1; i--) {

        

        if ( (M - i * N) % i == 0 ) {

            ans = i;

            break;

        }

    }



    cout << ans << '\n';

}




// Optimized solution to the same problem (faster):
#include <cstdio>

int main(){int N,M,i;scanf("%d%d",&N,&M);for (i=M/N;i>=1;i--){if((M-i*N)%i==0){printf("%d\n",i);break;}}}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

int main(){

    int N,M,i;std::cin>>N>>M;

    for (i=M/N;i>=1;i--){if((M-i*N)%i==0){std::cout<<i<<'\n';break;}}}

// Optimized solution to the same problem (faster):
#include <cstdio>

int main(){int N,M,i;scanf("%d%d",&N,&M);for (i=M/N;i>=1;i--){if((M-i*N)%i==0){printf("%d\n",i);break;}}}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main(void){

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

    if(n==1) {cout<<m<<endl; return 0;}

    int x = m/n;

    int ans =0;

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

       if(m%i==0) ans = i;

    }

    cout<<ans<<endl;

    

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main(void){

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

    if(n==1) {cout<<m<<endl; return 0;}

    int x = m/n;

    for(int i=x;i>0;i--){

       if(m%i==0) {cout<<i<<endl; return 0;}

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <algorithm>

#include <iostream>

#include <vector>

using namespace std;



vector<long long> enum_divisors(long long n) {

    vector<long long> res;

    for (long long i = 1LL; i * i <= n; i++) {

        if (n % i == 0) {

            res.emplace_back(i);

            if (i != n / i) res.emplace_back(n / i);

        }

    }

    sort(res.begin(), res.end());

    return res;

}



int main() {

    long long N, M; cin >> N >> M;

    long long ans = 1;

    for (long long d: enum_divisors(M)) {

        if (d * N <= M) ans = max(ans, d);

    }

    cout << ans << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <algorithm>

#include <iostream>

#include <vector>

using namespace std;



int main() {

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

    for (int g = m / n; g > 0; g--) {

        if (m % g == 0) {

            cout << g << endl;

            return 0;

        }

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)

#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)

#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)

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

#define sz(v) (int)(v).size()



using namespace std;

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;

const int mod = (int)1e9 + 7;

void dbg(){ cerr << "\n"; }  

template <typename T,typename ...T2>

void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main(){

	ll n,m, ans = 1;

	cin >>n >>m;

	

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

		if(m % i != 0) continue;

		

		if(i*n <=m)     ans = max(ans, i);

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

		

	}

	cout << ans <<"\n";

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



using namespace std;

 

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)

#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)

#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)

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

#define sz(v) (int)(v).size()



typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;

const int MD = 1e9+7; typedef vector<ll> VL;



void dbg(){ cerr << "\n"; }  

template <typename T,typename ...T2>

void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }





int main()

{

	

	cin.tie(0); ios_base::sync_with_stdio(false);

	int n, m;

	cin >>n >>m;

	

	int p= m/n;

	

	repr(i, p, 1){

		ll x = m - (i * (n-1));

		if(x % i ==0){

			cout << i <<"\n";  return 0;

		}

	

	}

	

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;



int main() {

	int n;

	int m;

	cin >> n >> m;



	int ans = 1;

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

		if (m%i == 0) {

			ans = m / i;

			break;

		}

	}

	cout << ans << endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



int main(){

  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;

      }

    }

  }

  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);



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

    int ans = 0;

    for (int i = 1; i <= max(N, (int)sqrt(M) + 1); ++i) {

        if (M % i == 0) {

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

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

        }

    }

    cout << ans << endl;



    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0);



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

    int ans = 0;

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

        if (M % i == 0) {

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

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

        }

    }

    cout << ans << endl;



    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include<iostream>



#include<cmath>



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;



			}



		}



	}



}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>

int main()

{	int n,m,t;

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

	if(m-n<10000000)

	{

		while(m%n) n++;

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

	}

	else

	{

		t=m/n;

		while(m%t) t--;

		printf("%d",t);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

long long int m,n,min1;

unsigned long long int f[100010]={0,1};

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;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstdio>

#include<cmath>

using namespace std;

typedef long long ll;

int main()

{

    ll n;

    ll m;

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

    ll maxl=m/n;

    if(m%n==0)

    {

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

        return 0;

    }

    ll minl=1;

    ll mid=(maxl+minl)/2;

    ll out=0;

    for(int i=minl;i<=maxl;++i)

    {

        if(m%i==0)

            if(out<i)

            out=i;

    }

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

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <cmath>

#include <iostream> 

using namespace std;

int n, m, tmp, mm;

int main(){

	

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

	mm = (int)sqrt(double(m));

	tmp = 0x7fffffff;

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

		if (m % i == 0){

			if (i >= n && i < tmp) tmp = i;

			if ((m / i) >= n && (m / i) < tmp) tmp = m / i; 

		}

	}

	printf("%d", m / tmp);

} 

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstdio>

#include<cmath>

using namespace std;

typedef long long ll;

int main()

{

    ll n;

    ll m;

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

    ll maxl=m/n;

    if(m%n==0)

    {

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

        return 0;

    }

    ll minl=1;

    ll mid=(maxl+minl)/2;

    ll out=0;

    for(int i=minl;i<=maxl;++i)

    {

        if(m%i==0)

            if(out<i)

            out=i;

    }

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

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#pragma GCC optimize(2)

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

	ll i,ans=0,n,m;

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

	for(i=1;i*i<=m;i++) if(m%i==0)

	{

		if(n*i<=m) ans=max(ans,i);

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

	}

	cout<<ans<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
//antaji dhil martasi. vul hoile amar kono dosh nai

#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n, m;

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

    int i = m/n;

    while(i > 1)

    {

        if(m%i == 0)

            break;

        i--;

    }

    printf("%d", i);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;

typedef unsigned long long ull;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;



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

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

#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)



#define DEBUG(x) cout<<#x<<": "<<x<<'\n'

#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'

#define ALL(a) (a).begin(), (a).end()



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

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



const ll MOD=1000000007ll;

// const ll MOD=998244353ll;

#define FIX(a) ((a)%MOD+MOD)%MOD



const double EPS=1e-11;

#define EQ0(x) (abs((x))<EPS)

#define EQ(a, b) (abs((a)-(b))<EPS)



ll gcd(ll a, ll b){

	if(b==0){

		return a;

	}

	return gcd(b, a%b);

}



// 約数を求める

vl divisor(ll n){

	vl res;

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

		if(n%i==0){

			res.push_back(i);

			if(i!=n/i){

				res.push_back(n/i);

			}

		}

	}

	return res;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	ll n, m;

	cin>>n>>m;

	if(n==1){

		cout<<m<<'\n';

		return 0;

	}

	ll ans=0;

	vl a=divisor(m);

	REP(i, a.size()){

		if(a[i]*n<=m){

			ans=max(ans, a[i]);

		}

	}

	cout<<ans<<'\n';

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	ll n, m;

	cin>>n>>m;

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

		if(m%i==0){

			cout<<i<<'\n';

			return 0;

		}

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;



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



// 約数を求める

vi divisor(int n){

	vi res;

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

		if(n%i==0){

			res.push_back(i);

			if(i!=n/i){

				res.push_back(n/i);

			}

		}

	}

	return res;

}



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	int n, m;

	cin>>n>>m;

	if(n==1){

		cout<<m<<'\n';

		return 0;

	}

	int ans=0;

	vi a=divisor(m);

	REP(i, a.size()){

		if(a[i]<=m/n){

			ans=max(ans, a[i]);

		}

	}

	cout<<ans<<'\n';

	return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;



int main(){

	ios::sync_with_stdio(false);

	cin.tie(0);

	ll n, m;

	cin>>n>>m;

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

		if(m%i==0){

			cout<<i<<'\n';

			return 0;

		}

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

	long long n,m;

	long long maxx=1;

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

	if(m<n)

	{

		printf("0");

		return 0;

	}

	else if(m%n==0)

	{

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

		return 0;

	}

	else 

	{

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

		{

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

			maxx=j;

			if(m<n*j)

			break;

		}

		printf("%lld",maxx);

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()

{

	ll i,ans=0,n,m;

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

	for(i=1;i*i<=m;i++) if(m%i==0)

	{

		if(n*i<=m) ans=max(ans,i);

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

	}

	cout<<ans<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstring>

#include <string>

#include <cstdio>

#include <cmath>

using namespace std;

const int N = 2e5 + 100;

int n, ans, m;

int main()

{

    cin >> n >> m;

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

    {

        if (m % i == 0)

        {

            if (i >= n)

                ans = max(m/i, ans);

            if (m / i >= n)

                ans = max(i, ans);

        }

    }

    cout << ans << endl;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;





int main()

{

    int n,m,a;

    cin>>n>>m;





    a=1;





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

    {

        if(m%i==0)

        {

           if(m/i>=n) a=max(i,a);

           if(i>=n) a=max(m/i,a);

        }



    }

    cout<<a<<endl;



    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

using ll =long long;





int main()

{

    ll n,k;

    cin>>n>>k;

    vector<ll>v;



    for(ll i=1;i*i<=k;i++)

    {

        if(k%i==0)

        {

            v.push_back(i);

            if(k/i!=i)v.push_back(k/i);

        }

    }



    ll counter;



    sort(v.begin(),v.end());



    for(int i=0;i<v.size();i++)

    {

        if(k/v[i]>=n)counter=v[i];

    }

    cout<<counter<<endl;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define int long long

int n, m;



int gcd(int a, int b)

{

	if(a == 0)

		return b;

	else

	{

		if(a > b) return gcd(a % b, b);

		else return gcd(b % a, a);

	}

}



inline bool check( int mid ) {

	return n * mid <= m;

}



main()

{

	int n, m, mx = 1; cin >> n >> m;

	

	if(n == m) return cout << 1, 0;

	if(m % n == 0) return cout << m / n, 0;

	if(n == 1) return cout << m << endl, 0;

	

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

	{

		if((m - i * n) % i == 0)

		return cout << i << endl, 0;

	}

	cout << 1 << endl;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define read(x) scanf("%lld",&x)

using namespace std;

const int maxn=1e5+6;

typedef long long LL;

int main() {

    LL n,m;

    read(n);

    read(m);

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

        if(m%i==0) {

            LL t=m/i;

            if(t>=n){

                cout<<i<<endl;

                break;

            }

        }

    }

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main()

{	int n,m,t;

	cin>>n>>m;

	if(m-n<10000000)

	{

		while(m%n) n++;

		cout<<m/n;

	}

	else

	{

		t=m/n;

		while(m%t) t--;

		cout<<t;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

long long n,m;

int main()

{

	cin>>n>>m;

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

	   {

	   	if(m%i==0)

	   	{

		    cout<<i;

	   		return 0;

		   }

	   }

	

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cmath>

#include <algorithm>

using namespace std;

int main()

{

	int N, M, i;

	cin >> N >> M;

	for (i = M / N; i >= 1; i--)

	{

		if (M%i == 0) {

			cout << i << endl;

			return 0;

		}

	}

	



}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

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;

            }

        }

    }



    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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 j = m / i;

            if (j >= n)

            {

                cout << i << endl;

                break;

            }

        }

    }

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



int main()

{

    long long  n, m, d, c, i;

    cin>>n>>m;

    d=m/n;

    c=m%n;

    for(i=d; i>0 ;i--)

    {

        if(c%i==0)

        {

            cout<<i<<endl;

            return 0;

        }

        c+=n;

    }

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <math.h>



int d[20002], e[20002], c = 0;



int main()

{	 

	int n, m, i, k, j;

	

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

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

		if(m % i == 0){

			d[c] = i;

			e[c++] = m / i;

		}

	}

	for(i = c - 1; i >= 0; i--){

		d[c] = e[i], e[c] = d[i], c++;

	}

	for(i = c - 1; i >= 0 && e[i] < n; i--);

	printf("%d\n", d[i]);

		

	return 0;

}

// Fastest known solution for this problem: