#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(void) {
  int a,b;
  cin >> a >> b;
  int ans;
  int x;
  for(int i=1 ; i<=b/2 ; i++)
  {
    if(a%i==0)
    {
      x=a/i;
    }
    else
    {
      x=a/i+1;
    }
    
    if(i*(x+1)<=b)
    {
      ans=i;
    }
  }
  cout << ans << endl;
  return 0;
}
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    ll A, B; cin >> A >> B;

    vector<int> cnt(200010);
    for(int i=A; i<=B; i++) {
        int v = i;
        for(ll j=1; j*j<=v; j++) {
            if(v % j == 0) {
                cnt[j]++;
                if(j != v/j) cnt[v/j]++;
            }
        }
    }

    int ans = 0;
    for(int i=1; i<200010; i++) {
        if(cnt[i] >= 2) {
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}
