require 'prime'

def divisors(primes, k)
  Enumerator.new do |y|
    if primes.size == k
      y << 1
    else
      p, e = primes[k]
      divisors(primes, k + 1).each {|d|
        (e + 1).times {|e1|
          y << p ** e1 * d
        }
      }
    end
  end
end

n, m = gets.split.map(&:to_i)
puts divisors(Prime.prime_division(m), 0).select{ |k| k if m >= n * k }.max
