#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N 7368791

static int m;
static int n;

static int h[N];

int main(void) {
  int i, j;
  
  for (;;) {
    scanf("%d%d", &m, &n);
    if (m == 0 && n == 0) break ;
    memset(h, 0, sizeof(h));
    
    for (i = m; i < N; ++i) {
      if (h[i] != 0) continue ;
      if (n == 0) break ;
      for (j = i; j < N; j += i)
        h[j] = 1;
      --n;
    }
    printf("%d\n", i);
  }

  return EXIT_SUCCESS;
}