#include <stdio.h>


int main () {
	int a,b;
	int tampung = 1;
	scanf("%d", &a);
	scanf("%d", &b);
	
	for ( int i = 0 ; i < a; i++) {
		if (tampung <= b) {
			tampung *= 2;
		} else {
			tampung += b;
		}
	}
	printf ("%d\n", tampung);
	return 0;
}
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define mset multiset
# define umap unordered_map
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)
# define lr(i,l,r) for(int i=l;(l>r?i>=r:i<=r);(l>r?--i:++i))

using namespace std;

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int dx[]={1,0,-1,0,-1,-1,1,1},dy[]={0,1,0,-1,-1,1,-1,1}; 
const int mod = 1e9+7;
const ll N = 1e5+4;

ll n,m;

void solve(){
	vector<int>d;
	cin>>n>>m;
	for(int i=1;i*i<=m;++i){
		if(m%i==0){
			d.pb(i);
			if(m/i!=i)d.pb(m/i);
		}
	}
	sort(all(d));
	reverse(all(d));
	rep(i,sz(d)){
		if(n*d[i]<=m){
			cout<<d[i];
			return;
		}
	}
}

int main(){
	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)
		solve();
	return 0;
}