Max = 1000000

Ps = Array.new(Max, true)
Ps[1] = false
2.upto(Max) do |j|
  if Ps[j]
    n = j * 2
    while n <= Max
      Ps[n] = false
      n += j
    end
  end
end


#すべての合計金額について、組み合わせがあるかどうか調べる
def createTable x, dish
  dp = Array.new(x + 1, false)
  dp[0] = true
  0.upto(x) do |sum|
    next if dp[sum] == false
    dish.each do |price|
      break if sum + price > x
      dp[sum + price] = true
    end
   end
  dp
end

#組み合わせから一番金額が大きいものを出力
def solve x, dp
  x.downto(0) do |sum|
    next unless Ps[sum]
    return sum if dp[sum]
  end
end

loop do
  n,x = $stdin.gets.chomp.split(" ").map(&:to_i)
  break if (n|x) == 0
  dish = Array.new
  n.times do
    dish << $stdin.gets.to_i
  end

  dp = createTable x,dish.sort!  
  ans = solve(x,dp)
  puts (ans == 0)? "NA" : ans 
end