#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define inf 1e9
#define linf 1e18
#define BASE 1000000
#define EPS 1e-10
#define PI acos(-1)
#define pii pair<int,int>
#define piii pair<int, pair<int, int> >
#define pdi pair<double,int>
#define vi vector<int>
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define ms(x,val_add) memset(x, val_add, sizeof(x))
#define pb(x) push_back(x)
#define make_unique(x) sort(ALL(x)) ; x.erase( unique(ALL(x)), x.end()) ;
#define dbg(x) do { cout << #x << " = " << x << endl; } while(0)
#define mp(x, y) make_pair(x, y)
#define minimize(x, y) x = min(x, y)
#define maximize(x, y) x = max(x, y)


/*** IMPLEMENTATION ***/
bool exitInput = false;
int ntest = 1, itest = 1 ;

const int dx[4] =
{
    -1, 0, 1, 0
};
const int dy[4] =
{
    0, 1, 0, -1
};
// const int dx[8] = {-2, -1, -1, +0, +0, +1, +1, +2};
// const int dy[8] = {+0, -1, +1, -2, +2, -1, +1, +0};

/** Knight Move **/
// const int dx[8] = {+1, +2, +2, +1, -1, -2, -2, -1};
// const int dy[8] = {+2, +1, -1, -2, -2, -1, +1, +2};

const ll Mod = 1000000007LL;
const int maxn = 500 + 5;
const int maxv = 500 + 5;
const int maxe = 10000 + 5;

ll addMod( ll &x, ll y )
{
    x = ( x + y ) % Mod;
}

int main()
{
#ifdef HOME
    freopen( "input.txt", "r", stdin );
    freopen( "output.txt", "w", stdout );
#endif // HOME
    ios_base::sync_with_stdio( false );
    cin.tie( NULL );
    cout << setprecision( 10 );
    cout << fixed;

    int A, B;
    cin >> A >> B;
    A = A + B;
    if(A >= 15 && B >= 8)
        cout << 1;
    else if(A >= 10 && B >= 3)
        cout << 2;
    else if(A >= 3)
        cout << 3;
    else
        cout << 4;


    return 0;
}


#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll A, B; cin >> A >> B;
  ll ans = 1;
  for (ll x = 1; x <= B; x++) {
    ll z = (B / x) * x;
    ll y = z - x;
    if (A <= y) ans = x;
  }
  cout << ans << endl;

  return 0;
}

