require 'prime'

loop do
	n, budget = gets.split.map &:to_i
	break if n == 0
	dish = (1..n).map{gets.to_i}.sort

	table = [false] * (budget+1)
	table[0] = true

	k = 0
	(1..budget).each do |x|
		dish.each do |d|
			break if d > x
			(table[x] = table[x-d]) && break
		end
		if table[x]
			k += 1
			if k > dish[0] + 10
				(x+1..budget).each{|i| table[i] = true}
				break
			end
		else
			k = 0
		end
	end

	candidates = (2..budget).select {|i| table[i]}.reverse
	puts candidates.find{|x| Prime.prime?(x)} || 'NA'
end