#include <stdio.h>

int ans = -1;
char visited[1000001], isprime[1000001];
int price[30];
int n, x;

void eratos(int m)
{
	int i, j;
	for(i=2; i<=m; ++i)
		isprime[i] = 1;
	isprime[0] = isprime[1] = 0;
	
	for(i=2; i*i<=m; ++i){
		if(isprime[i]){
			for(j=i*2; j<=m; j+=i)
				isprime[j] = 0;
		}
	}
}

void search(int c)
{
	int i;
	if(visited[c])
		return;
	visited[c] = 1;
	
	if(ans < c && isprime[c])
		ans = c;
	
	for(i=0; i<n; ++i){
		if(c+price[i] <= x)
			search(c+price[i]);
	}
}

int main(void)
{
	eratos(1000000);
	while(scanf("%d%d", &n, &x), n){
		int i;
		for(i=0; i<n; ++i)
			scanf("%d", &price[i]);
		
		ans = -1;
		for(i=0; i<=x; ++i)
			visited[i] = 0;

		search(0);
		if(ans == -1)
			puts("NA");
		else
			printf("%d\n", ans);
	}
	return 0;
}