#include<stdio.h>
int g[1000001],k[30],i,n;

int prime(int);
int goukei(int);
int saiki(int);

int saiki(int y){
	if(prime(y) && goukei(y))return y;
	if(y>2)return saiki(y-1);
	else return 0;
}

int goukei(int z){
	if(g[z]==2)return 1;
	else if(g[z]==1)return 0;
	for(i=0;i<n;i++){
		if(z-k[i]>0) goukei(z-k[i]);
		else if(z-k[i]==0){
			g[z]=2;
			return 1;
		}
	}
	return 0;
}

int prime(int n){
	int i=3;
	if(n<2)return 0;
	else if(n==2)return 1;
    if(n%2==0)return 0;
    for(;i*i<=n;i+=2)if(n%i==0)return 0;
	return 1;
}

int main(){
	int x,a;
	while(1){
		scanf("%d%d",&n,&x);
		if(!n&&!x)break;
		for(i=0;i<n;i++) scanf("%d",&k[i]);
		a=saiki(x);
		if(a)printf("%d\n",saiki(x));
		else puts("NA");
	}
}