#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n, m;
    while(cin >> n >> m && (n || m)) {
        int cnt=0;vector<int> primes; bool num[m];
        memset(num, false, sizeof(num));
        num[0] = true;

        for(int i=0;i < n;++i) {int hoge; cin>>hoge; if(!(hoge%2)){++cnt;}}
        if (cnt == n) {puts("NA"); continue;}

        for(int i=2,len=m/2;i<=len;++i) {
            if (num[i-1]) continue;
            for(int j=i+i;j <= m;j+=i) {
                num[j-1] = true;
            }
        }

        for(int i=0;i < m;++i) {
            if (!num[i]) {
                primes.push_back(i+1);
            }
        }

        cout << primes.back() << endl;
    }

    return 0;
}