#include <bits/stdc++.h>
using namespace std;

#define int				long long
#define FOR( i, m, n )	for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )		FOR( i, 0, n )
#define REPR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )		(a).begin(), (a).end()
#define MP				make_pair

typedef pair<int, int> P;

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

bool is_prime[1000001];
bool dp[1000001];

signed main(){
	fill( is_prime, is_prime + 1000001, true );
	is_prime[0] = is_prime[1] = false;

	REP( i, 1000001 ) {
		if( is_prime[i] ) {
			for( int j = i * i; j < 1000001; j += i ) {
				is_prime[j] = false;
			}
		}
	}

	int n, x;
	while( cin >> n >> x, n, x ) {
		fill( dp, dp + 1000001, false );

		vector<int> v( n );
		REP( i, n ) cin >> v[i];
		
		dp[0] = true;
		REP( i, x ) {
			if( dp[i] ) {
				REP( j, v.size() ) {
					if( i + v[j] <= x ) {
						dp[i + v[j]] = true;
					}
				}
			}
		}

		int ans = 0;
		REPR( i, x ) {
			if( dp[i] && is_prime[i] ) {
				ans =i;
				break;
			}
		}

		if( ans ) cout << ans << endl;
		else	  cout << "NA" << endl;

	}

}

