#include <iostream>
#include<algorithm>
#include<string>
#include<map>
#include <iterator>
#include<iomanip>
#include <time.h>
#include<vector>
#include<cmath>
#include <cstdio>
#include<queue>
#include<unordered_map>
#include<stack>
#include<list>
#include<stdio.h>
#include<set>
#include <functional>

#define hash_mod 2305843009213717
#define mod7 1000000007
#define mod9 1000000009
#define mod2 30000000
#define pa(a,b) make_pair(a,b)
#define f first
#define s second
#define pb(a)  push_back(a)
#define all(a) a.begin() , a.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define LL  long long int
#define oo 1e9
#define pi 3.141592653589793238
#define eps  1e-6



LL maxx(LL & a , LL & b){ return a>b ?  a : b ;}
LL minn(LL & a , LL & b){ return a>b ?  b : a ;}

using namespace std;
//int dx[] = {1 , -1 , 0 , 0} ;
//int dy[] = {0 , 0 , 1 , -1} ;
void boostIO(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
LL gcd(LL a, LL b) {
    return b == 0 ? a : gcd(b, a % b);
}
int int_gcd(int a, int b) {
    return b == 0 ? a : int_gcd(b, a % b);
}
LL lcm(LL a , LL b )
{
    return a / gcd(a , b) * b;
}
LL poww(LL base, LL exp , LL mod){
  base %= mod;
  LL result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return result;
}
LL fact[30] ;
vector<LL>primes ;
void sieve(){
    bool prime[200200] = {0} ;
    for(int i = 2 ; i <= 100000 ; i++){
        if(prime[i]){
            continue ;
        }
        for(int j = i * 2 ; j <= 100000 ; j += i){
            prime[j] = 1;
        }
    }

    for(int i = 2 ; i <= 100000 ; i++){
        if(!prime[i]){
            primes.pb(i) ;
        }
    }

    return ;
}
LL pw(LL base , LL p){
    LL ret = 1 ;
    while(p--){
        ret *= base ;
    }
    return ret ;
}
void initial(){
    fact[0] = 1 ;

    for(LL i = 1 ; i <= 20 ; i++){
        fact[i] = fact[i - 1] * i ;
    }

    return ;
}
void solve(LL n){
    LL val = 0 ;

    for(int i = 1 ; i <= n ; i++){
        if(fact[i] % n == 0){
            val = i ;
            break ;
        }
    }

    LL down = fact[val] / n ;

    cout << val << " " << down << endl ;
    vector<LL> powers ;

    int tot = 0 ;

    while(down > 1){
        for(int i = 20 ; i >= 1 ; i--){
            if(down % fact[i] == 0){
                powers.pb(i) ; down /= fact[i] ;
                tot += i ;
                break ;
            }
        }
    }

    for(int i = tot ; i < val ; i++){
        powers.pb(1) ;
    }
    sort(all(powers)) , reverse(all(powers)) ;
    LL ans = 1 ;

    for(int i = 0 ; i < powers.size() ; i++){
        ans = ans * pw(primes[i] , powers[i]) ;
    }

    printf("%I64d %I64d\n" , n , ans) ;
}
vector<int> divisors(int x){
    LL div = 1 ; vector<int> ret ;

    while(div * div <= x){
        if(x % div == 0){
            ret.pb(x / div) ;
            if(x / div != div){
                ret.pb(div) ;
            }
        }
        div = div + 1 ;
    }

    return ret ;
}
int main()
{
    int n , m ; cin >> n >> m ;

    vector<int> d = divisors(m) ;

    int ans = 1 ;

    for(int i = 0 ; i < d.size() ; i++){
        if(m / d[i] >= n){
            ans = max(ans , d[i]) ;
        }
    }

    cout << ans << endl ;
}


Measured memory_bytes: 256