require 'prime'
require 'set'
loop do
    n, x = gets.split.map(&:to_i)
    break if n == 0
    a = (1..n).map { gets.to_i }.sort
    t = Array.new(x+1, false)
    t[0] = true
    (0..x).each do |i|
        next if !t[i]
        a.each do |j|
            break if i + j > x
            t[i + j] = true
        end
    end
    ans = nil
    x.downto(1) do |i|
        if t[i] && Prime.prime?(i)
            ans = i
            break
        end
    end
    puts ans ? ans : 'NA'
end

