def createPrimeTable max
  ps = Array.new(max + 1, true)
  ps[0] = false
  ps[1] = false
  2.upto(max) do |i|
    if ps[i]
      j = i + i
      while j <= max
        ps[j] = false
        j += i
      end
    end
  end
  ps
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
  ps = createPrimeTable x
  x.downto(0) do |sum|
    next unless ps[sum]
    return sum if dp[sum]
  end
  "NA"
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!  
  puts solve(x,dp)
end