require 'prime'
require 'set'
loop do
    n, x = gets.split.map(&:to_i)
    break if n == 0
    a = (1..n).map { gets.to_i }
    s = Set[0]
    (0..x).each do |i|
        next if !s.include?(i)
        a.each do |j|
            s << i + j if i + j <= x
        end
    end
    ans = nil
    s.to_a.sort.reverse.each do |i|
        if Prime.prime?(i)
            ans = i
            break
        end
    end
    puts ans ? ans : 'NA'
end
