#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int MAX = 7368791 + 1;
int main() {
    int m, n;
    while (cin >> m >> n, m | n) {
        vector<bool> used(MAX);
        int idx = m;
        for (int i = 0; i < n; i++) {
            while (used[idx]) idx++;
            for (int k = 1; k * idx < used.size(); k++) {
                used[k * idx] = true;
            }
        }
        while (used[idx]) idx++;
        cout << idx << endl;
    }
    return 0;
}

