#include <iostream>
using namespace std;
int n, x;
int primeTable[1000001];

void makePrimeTable(void) {

    primeTable[0] = false;
    primeTable[1] = false;
    for(int i = 2; i < 1000001; i++) {
        primeTable[i] = true;
    }
    
    for(int i = 2; i < 1000001; i++) {
        if(primeTable[i]) {
            for(int j = i + i; j < 1000001; j += i) {
                primeTable[j] = false;
            }
        }
    }
}


void search(int k, int * price, bool * numbers) {
    
    for(int i = 0; i < n; i++) {
        if(k + price[i] < x + 1) {
            if(!numbers[k + price[i]]) {
                numbers[k + price[i]] = true;
                search(k + price[i], price, numbers);
            }
        }
    }
}

int main(void){
    // Your code here!
    makePrimeTable();
    
    while(cin >> n >> x) {
        if(n == 0 && x == 0) break;
        
        int price[n];
        bool numbers[x+1];
        
        for(int i = 0; i < n; i++) {
            cin >> price[i];
        }
        for(int i = 0; i < x+1; i++) {
            numbers[i] = false;
        }
        numbers[0] = true;

        search(0, price, numbers);
        
        bool flag = true;
        for(int i = x; i >= 0; i--) {
            if(numbers[i] && primeTable[i]) {
                flag = false;
                cout << i << endl;
                break;
            }
        }
        if(flag) cout << "NA" << endl;
        
    }
}

