# see: https://kimiyuki.net/blog/2016/06/27/icpc-2016-domestic-c/

loop do
  m, n = gets.split.map(&:to_i)
  break if m == 0

  nxt = m
  used = []
  n.times do |i|
    a = nxt
    while a <= 7368791
      used[a] = true
      a += nxt
    end

    loop do
      nxt += 1
      break unless used[nxt]
    end
  end

  puts nxt
end