#include<cstdio>

const int MAX = 7500111;
int N, M;
int C[MAX];

int main() {
    for (int tt=1; scanf("%d%d", &M, &N), N|M; tt++) {
	int cur = M;

	for (int i=0; i<N; i++) {
	    while (C[cur] == tt) cur++;

	    for (int j=cur; j<MAX; j+=cur)
		C[j] = tt;
	}

	while (C[cur] == tt) cur++;
	printf("%d\n", cur);
    }

    return 0;
}
