#include<iostream>
#include<cstring>
int p[1000100]={};
int u[1000100]={};
#define MAX 1000000
#define rep(i,n) for(int i=0;i<n;i++)
#include<vector>
using namespace std;
int main()
{
    memset(u,0,sizeof(u));
    p[0]=1;
    p[1]=1;
    p[2]=0;
    for(int i=2;i<MAX+1;i++)
        if(p[i] ==0){for(int j=2;(j*i)<MAX+1;j++) {p[ i*j ]=1;}}

    vector<int> primes;
    rep(i,MAX+1){if(!p[i]){primes.push_back(i); /*cout<<i<<" ";*/}}

    int n,x;
    while(cin>>n>>x)
    {
        //cout << n <<" " <<x << endl;
        if(n==0&&x==0){break;}
        memset(u,0,sizeof(u));
        int t;
        u[0]=1;
        int pn = 0;
        int na = 1;
        for(pn=0;primes[pn]<=x ;pn++);
        rep(i,n)
        {
            cin>>t;
            rep(j,x+1)
            {
                if(u[j] == 1 &&(na ))for(int k=1;j+k*t<x+1;k++)
                {
                    u[j+k*t]=1;
                    if(primes[pn]==j+k*t) {na=0;break;}
                }
            }
        }
        //cout << "listed"<<endl;
        for( pn;pn!=0;pn--)
        {
            if(u[primes[pn]] && (!p[primes[pn]])){cout << primes[pn]<<endl; na=0;break;}
        }
        if(na)cout<<"NA"<<endl;
    }

    return 0;
}