require'prime'
t=[]
Prime.each(1e6){|i|t[i]=1}
while(n,x=gets.split.map &:to_i)[0]>0
t[m=0]=2
c=(1..n).map{gets.to_i}
(0..x).each{|i|(v=t[i])&&v!=1&&(c.each{|j|t[j+i]|=2};v&1==1&&m<i&&m=i)}
puts m<1?:NA:m
t.map!{|i|i&1==1?1:nil}
end