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