require'prime' l,h=gets.split.map &:to_i a=[*Prime.each(h**0.5)].reverse a.map{|x|(h/x*x).step(l,-x){|t|a.any?{|q|q