#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int l=m/n+1;
	for(int i=l;i>=1;i--)
	{
		if(m%i==0&&m/i>=n)
			return printf("%d\n",i),0;
	}
	return 0;
}

