#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
int a[7368792];
int main(){
	int i,c,m,n,b;
	while (~fscanf(stdin, "%d%d", &m, &n), m || n) {
		memset(a, 0, sizeof(a));
		for (c = 0, b = m; c != n;) {
			if (!a[b]) {
				for (i = 1; i*b < 7368792; i++)
					a[i*b] = 1;
				c++;
			}
			b++;
		}
		while (a[b++]);
		P(d, b-1);
	}
	return 0;
}