#include <bits/stdc++.h>
#define MAX 7368791
using namespace std;

int main()
{
	int m, n;
	while (cin >> m >> n, m || n) {
		vector<bool> thieve(MAX + 1, false);
		for (int i = m; ;i++) {
			if (thieve[i]) {
				continue;
			}
			if (n) {
				n--;
				for (int j = i; j <= MAX; j += i) {
					thieve[j] = true;
				}
			}
			else {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}