require'prime' l,h=gets.split.map &:to_i a=*Prime.each(h**0.5) (x=a.pop;(h/x*x).step(l,-x){|t|a.all?{|q|t%q>0}&&(p t;exit)})while a[0]