#include <bits/stdc++.h>
#define lowbit(x) ((x)&(-x))
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int N=160;
const int mod=1000000007;

int a,b;

int main() {
    cin>>a>>b;
    int ans=1;
    for(int i=b;i>=1;i--) {
        int r=b/i;
        int l=(a+i-1)/i;
        // cout<<i<<" "<<l<<"  "<<r<<endl;
        if(r-l+1>=2) {
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include<stdlib.h>
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
#include <stack>
#include<stdlib.h>
#include<stdio.h>
#include <sstream>
#include <inttypes.h>
#include<climits>


//#include<bits/stdc++.h>
using namespace std;

typedef  long long ll;
//typedef  unsigned long long int llt;
const int M = 1e6;

ll min(int x , int y){
    return ( x<y ? x:y);
}
int max(int x , int y){
    return ( x<y ? y:x);
}

int gcd(int  a, int b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
 
// Function to return LCM of two numbers
ll lcm(ll a, ll b)
{
    return (a / gcd(a, b)) * b;
}
int findMaxGCD(int arr[], int n)
{
    // Calculating MAX in array
    int high = 0;
    for (int i = 0; i < n; i++)
        high = max(high, arr[i]);
 
    // Maintaining count array
    int count[high + 1];
    for(int i=0;i<=high;i++){
        count[i]=0;
    }
    for (int i = 0; i < n; i++)
        count[arr[i]]++;
 
    // Variable to store the
    // multiples of a number
    int counter = 0;
 
    // Iterating from MAX to 1
    // GCD is always between
    // MAX and 1. The first
    // GCD found will be the
    // highest as we are
    // decrementing the potential
    // GCD
    for (int i = high; i >= 1; i--)
    {
        int j = i;
       counter = 0;
   
        // Iterating from current
        // potential GCD
        // till it is less than
        // MAX
        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;
        }
    }
}
 
void solve(){
    
    
    int a,b;
    cin>>a>>b;
    
   /* int mx=1;
    
    for(int i=b;i>a;i--){
        
        
        int y =i;
        
        for(int j = y-1;j>=a;j--){
            
            mx = max(mx , gcd(y,j));
        }
    }
    cout<<mx<<endl;
    return;*/
    
    int arr[b-a+1];
    
    for(int i=0;i<(b-a+1);i++){
        arr[i] = a+i;
    }
    cout<<findMaxGCD(arr , (b-a+1));
    return;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
        solve();
    return 0;

}


