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

int main()
{
  int64_t N, M, ans;
  cin >> N >> M;
  for (int x = M / N; x >= 1; x--)
  {
    if (M % x == 0)
    {
      cout << x << endl;
      break;
    }
  }
}
