import sys



# import re

import math

import collections

# import decimal

import bisect

import itertools

import fractions

# import functools

import copy

import heapq

import decimal

# import statistics

import queue



sys.setrecursionlimit(10000001)

INF = 10 ** 16

MOD = 10 ** 9 + 7



ni = lambda: int(sys.stdin.readline())

ns = lambda: list(map(int, sys.stdin.readline().split()))

na = lambda: list(map(int, sys.stdin.readline().split()))





# ===CODE===





def main():

    def make_divisors(n):

        divisors = []

        for i in range(1, int(n ** 0.5) + 1):

            if n % i == 0:

                divisors.append(i)

                if i != n // i:

                    divisors.append(n // i)



        divisors.sort(reverse=True)

        return divisors



    n, m = ns()

    gcd = make_divisors(m)



    max_gcd = 1

    for d in gcd:

        if m // d >= n:

            max_gcd = d

            break



    print(d)





if __name__ == '__main__':

    main()

import sys



# import re

import math

import collections

# import decimal

import bisect

import itertools

import fractions

# import functools

import copy

import heapq

import decimal

# import statistics

import queue



sys.setrecursionlimit(10000001)

INF = 10 ** 16

MOD = 10 ** 9 + 7



ni = lambda: int(sys.stdin.readline())

ns = lambda: list(map(int, sys.stdin.readline().split()))

na = lambda: list(map(int, sys.stdin.readline().split()))





# ===CODE===





def main():

    def make_divisors(n):

        divisors = []

        for i in range(1, int(n ** 0.5) + 1):

            if n % i == 0:

                divisors.append(i)

                if i != n // i:

                    divisors.append(n // i)



        # divisors.sort(reverse=True)

        return divisors



    n, m = ns()

    gcd = make_divisors(m)



    max_gcd = 1

    for d in gcd:

        if m // d >= n:

            max_gcd = max(max_gcd, d)



    print(max_gcd)





if __name__ == '__main__':

    main()

import sys

# import re
import math
import collections

# import decimal
import bisect
import itertools
import fractions

# import functools
import copy
import heapq
import decimal

# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10**16
MOD = 10**9 + 7
ni = lambda: int(sys.stdin.readline())
ns = lambda: list(map(int, sys.stdin.readline().split()))
na = lambda: list(map(int, sys.stdin.readline().split()))
# ===CODE===
def main():
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n**0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)
        divisors.sort(reverse=True)
        return divisors

    n, m = ns()
    gcd = make_divisors(m)
    max_gcd = 1
    for d in gcd:
        if m // d >= n:
            max_gcd = d
            break
    print(d)


if __name__ == "__main__":
    main()

import sys

# import re
import math
import collections

# import decimal
import bisect
import itertools
import fractions

# import functools
import copy
import heapq
import decimal

# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10**16
MOD = 10**9 + 7
ni = lambda: int(sys.stdin.readline())
ns = lambda: list(map(int, sys.stdin.readline().split()))
na = lambda: list(map(int, sys.stdin.readline().split()))
# ===CODE===
def main():
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n**0.5) + 1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n // i)
        # divisors.sort(reverse=True)
        return divisors

    n, m = ns()
    gcd = make_divisors(m)
    max_gcd = 1
    for d in gcd:
        if m // d >= n:
            max_gcd = max(max_gcd, d)
    print(max_gcd)


if __name__ == "__main__":
    main()

-        divisors.sort(reverse=True) +        # divisors.sort(reverse=True) -            max_gcd = d -            break -    print(d) +            max_gcd = max(max_gcd, d) +    print(max_gcd)