#include <iostream>
#include <array>

#define MAX 1000000

void makePrime(auto& p_ptr, int data = MAX + 1)
{
    p_ptr[0] = p_ptr[1] = false;

    for (int i = 2; i * i < data; ++i) {
        for (int j = 2; j * i <= data; ++j) {
            p_ptr[j * i] = false;
        }
    }
}

int main()
{
    static std::array<bool, MAX> p;
    std::fill(p.begin(), p.end(), true);
    int price_num;
    int budget;

    makePrime(p);
    
    while (std::cin >> price_num >> budget) {
        if (price_num == 0 && budget == 0) break;
        
        //dp
        bool dp[MAX + 1] = {};
        int PriceData[price_num];

        for (int i = 0; i < price_num; ++i) {
            std::cin >> PriceData[i];
            dp[PriceData[i]] = true;
        }

        for (int i = 0; i < price_num; ++i) {
            for (int j = 0; j < MAX; ++j) {
                if (dp[j] && PriceData[i] + j <=  MAX) {
                    dp[PriceData[i] + j] = true;
                }
            }
        }
        
        int ans = 0; 
        for (int i = budget; i > 0; --i) {
            if (dp[i] && p[i]) {
                ans = i;
                break;
            }
        }

        if (ans) {
            std::cout << ans << std::endl;
        } else {
            std::cout << "NA" << std::endl;
        }
    }
    return 0;
}