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