#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

const int maxX = 2e5 + 1;
int divCount[maxX];

int main()
{
  int a, b;
  while (~scanf("%d %d", &a, &b))
  {
    memset(divCount, 0, sizeof(divCount));
    for (int i = a; i <= b; i++)
    {
      for (int j = 2, end = sqrt(i); j <= end; j++)
        if (i % j == 0)
        {
          divCount[j]++;
          if (i % (i / j) == 0 && j != i / j)
            divCount[i / j]++;
        }
      divCount[i]++;
    }

    int ans = 1;
    for (int i = 2; i < maxX; i++)
      if (divCount[i] > 1)
        ans = i;
    printf("%d\n", ans);
  }
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
int findMaxGCD(int arr[], int n)
{
    int high = 0;
    for (int i = 0; i < n; i++)
        high = max(high, arr[i]);
 
    int count[high + 1] = {0};
    for (int i = 0; i < n; i++)
        count[arr[i]]++;
 
    int counter = 0;
 
    for (int i = high; i >= 1; i--)
    {
        int j = i;
       counter = 0;
  
        while (j <= high)
        {
            // A multiple found
 
            if(count[j] >=2)
               return j;
 
           else if (count[j] == 1)        
                counter++;        
 
            // Incrementing potential
            // GCD by itself
            // To check i, 2i, 3i....
            j += i;
 
            // 2 multiples found,
            // max GCD found
            if (counter == 2)        
                return i;
        }
    }
}
int main()
{
    int a,b;
    cin>>a>>b;
    int c[b-a+1];
    for(int i=0; i<b-a+1; i++)
    {
        c[i]=a+i;
    }
 /*   for(int i=0; i<b-a+1; i++)
    {
        cout<<c[i]<<" ";
    }
    cout<<endl;*/
    int n;
    n=b-a+1;
    cout << findMaxGCD(c, n);
 
    return 0;
}