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


int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	int ans=1;
	for(int i=m/n+1;i>=2;i--){
		if(m%i==0&&m/i>=n){
			ans=i;
			break;
		}
	}
	printf("%d\n",ans);
}