#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>
#include <cmath>

using namespace std;

int main() {
  const int lim = 1000000;
  vector<bool> primes( lim + 1 );
  fill( primes.begin(), primes.end(), true );
  primes[ 0 ] = primes[ 1 ] = false;
  const int l = (int)sqrt( lim );
  for ( int i = 2; i <= l; i++ ){
	if ( primes[ i ] ) {
	  for ( int j = i * i; j <= lim; j += i ) {
		primes[ j ] = false;
	  }
	}
  }
  
  while( true ) {
	int n, x;
	cin >> n >> x;
	if ( n == 0 and x == 0 ) break;
	
	vector<int> vs( n );
	for ( int i = 0; i < n; i++ ) {
	  cin >> vs[ i ];
	}
	sort( vs.begin(), vs.end() );
	vector<bool> cands( x + 1 );
	int ans = -1;
	fill( cands.begin(), cands.end(), false );
	cands[ 0 ] = true;
	for ( int i = 0; i <= x; i++ ) {
	  if ( cands[ i ] ) {
		for ( int v : vs ) {
		  if ( i + v <= x ) {
			cands[ i + v ] = true;
		  }
		}
		if ( primes[ i ] ) {
		  ans = i;
		}
	  }
	}
	if ( ans == -1 ) {
	  cout << "NA" << endl;	  
	} else {
	  cout << ans << endl;
	}
  }
}