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

int main(){
  int N,M; cin >> N >> M;
  int result=0; int div=M/N;
  while(!result){
    if(M%div==0){
      result=div;
    }
    div--;
  }
  cout << result << endl;
}