MAX = 1_000_000

isPrime = Array.new(MAX+1,true)
(2..1000).each{|i|
  if isPrime[i]
    (i*2).step(MAX,i){|j|
      isPrime[j]=false
    }
  end
}

loop{
  n,x = gets.split.map(&:to_i)
  break if(n|x) == 0
  m = Array.new(n)
  n.times{|i|
    m[i] = gets.to_i
  }
  b = Array.new(x+1,nil)
  b[0]=true
  ans ="NA"
  (1..x).each{|i|
    (0...n).each{|j|
      if i-m[j]>=0 && b[i-m[j]]
        b[i]=true
        ans = i if isPrime[i]
        break
      end
    }
  }
  puts ans
}