### constant

MAX_P = 1000000

### subroutines

def gen_primes(max_p)
  primes = Array.new(max_p + 1){true}
  primes[0] = primes[1] = false

  for p in (2..max_p)
    if primes[p]
      for q in (p * p).step(max_p, p)
        primes[q] = false
      end
    end
  end

  primes
end

### main

primes = gen_primes(MAX_P)

while true
  n, x = gets.strip.split(' ').map{|s| s.to_i}
  break if n == 0 && x == 0

  sums = (MAX_P + 1).times.map{false}
  menu = []

  n.times.each do
    pr = gets.strip.to_i
    menu << pr
    sums[pr] = true
  end

  for pr in menu
    for i in (0..MAX_P)
      if sums[i] && i + pr <= MAX_P
        sums[i + pr] = true
      end
   end
  end

  max_sum = 0
  x.downto(0).each do |i|
    if sums[i] && primes[i]
      max_sum = i
      break
    end
  end

  puts (max_sum > 0 ? max_sum : 'NA')
end