# 約数列挙
# https://atcoder.jp/contests/abc112/tasks/abc112_d
require 'prime'
N, M = gets.split.map(&:to_i)
m = M
ary = []
MN = M/N

# https://qiita.com/seinosuke/items/fde2e0471dcf937e5a09
class Integer
  def my_divisor_list3
    return [1] if self == 1
    first, *rest = Prime.prime_division(self).map do |p, k|
      (0..k).map{|i| p**i}
    end
    first.product(*rest).map do |a|
      a.inject(&:*)
    end.max_by { |i| (i <= MN) ? i : 0 }
  end
end

p M.my_divisor_list3