#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, m, ans = 1;
	cin >> n >> m;
	int a = m / n;
	for(int i = a; i >= 1; i--)
		if(m % i == 0){
			ans = i;
			break;
		}
	cout << ans;
	return 0;
}