#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int A,B;cin>>A>>B;
  map<int,int>mp;
  for(int i=A;i<=B;i++){
    for(int j=1;j*j<=i;j++){
      if(i%j==0){
        mp[j]++;
        if(j!=i/j){
          mp[i/j]++;
        }
      }
    }
  }
  int ans=0;
  for(auto i:mp){
    if(i.second>=2){
      ans=i.first;
    }
  }
  cout<<ans<<endl;
}

#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)
        {
            if(count[j] >=2)
               return j;
 
           else if (count[j] == 1)        
                counter++;
            j += i;
            if (counter == 2)        
                return i;
        }
    }
}

int main()
{
    int a,b;
    cin >> a >> b;
    int arr[b-a+1];
    for(int i = a; i <= b; ++i){
        arr[i-a] = i;
    }
    int n = sizeof(arr) / sizeof(arr[0]);
 
    cout << findMaxGCD(arr, n);
 
    return 0;
}