#include <bits/stdc++.h>
int main() {
  long a, b;
  while (scanf("%ld%ld", &a, &b) != EOF) {
    if (a == b) {
      if (a % 2 == 0)
        printf("2\n");
      else if (a % 3 == 0)
        printf("3\n");
      else if (a % 5 == 0)
        printf("5\n");
      else if (a % 7 == 0)
        printf("7\n");
      else
        printf("%ld", a);
    } else
      printf("2\n");
  }
  return 0;
}
