#include <iostream>
#include <vector>
#include <string.h>

using namespace std;
bool IsPrime[1000001];
vector<int> Prime;
bool DP[1000001];
void calc()
{
	memset(IsPrime, 1, sizeof(IsPrime));
	for(int i = 2; i < 1000001; ++i)
	{
		if(IsPrime[i])
		{
			Prime.push_back(i);
			for(int j = 2 * i; j < 1000001; j += i)
			{
				IsPrime[j] = false;
			}
		}
	}
}

void solve()
{
	calc();
	int n , x;
	while(cin >> n >> x)
	{
		if(!n && !x)
		{
			break;
		}
		vector<int> Price(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> Price[i];
		}
		
		memset(DP, 0, sizeof(DP));
		DP[0] = true;
		for(int i = 0; i < x; ++i)
		{
			if(DP[i])
			{
				for(int j = 0; j < n; ++j)
				{
					if(i + Price[j] <= x)
					{
						DP[i + Price[j]] = true;
					}
				}
			}
		}
		int pos = 0;
		while(Prime[pos] < x)
		{
			pos++;
		}
		if(Prime[pos] > x)
		{
			pos--;
		}
		while(DP[Prime[pos]] == false)
		{
			pos--;
			if(pos < 0)
			{
				cout << "NA" << endl;
				goto NEXT;
			}
		}
		cout << Prime[pos] << endl;
NEXT:
		;
	}
}

int main()
{
	solve();
	return(0);
}