Problem:
Score : 400 points

Problem Statement

You are given integers N and M.

Consider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

N \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

N M

Output

Print the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.

Sample Input 1

3 14

Sample Output 1

2

Consider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.

Sample Input 2

10 123

Sample Output 2

3

Sample Input 3

100000 1000000000

Sample Output 3

10000

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramD a = new ProgramD();
            a.main();//実行する

        }

    }

    class ProgramA
    {
        public void main()
        {
            //数値入力する
            string[] s = Console.ReadLine().Split(' ');


            //それぞれの文字列で答えを出す
            if ((int.Parse(s[0]) * int.Parse(s[1])) % 2 == 1)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

        }
    }

    class ProgramB
    {
        public void main()
        {

            //入力
            string input = Console.ReadLine();
            int n = int.Parse(input);

            string[] num = new string[n];


            //char型で読み込み、int型に変換。そこから数を足して、char型に戻す
            for (int i = 0; i < n; i++)
            {
                string s = Console.ReadLine();

                if (num.Contains(s) == true)
                {
                    Console.WriteLine("No");
                    return;
                }

                if (i == 0)
                {
                    num[0] = s;
                }
                else
                {
                    if (num[i - 1][num[i - 1].Length - 1] != s[0])
                    {
                        Console.WriteLine("No");
                        return;
                    }

                    num[i] = s;
                }


            }

            Console.WriteLine("Yes");

        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            string[] input = Console.ReadLine().Split();
            long n = long.Parse(input[0]);
            long x = long.Parse(input[1]);

            string[] s = Console.ReadLine().Split();
            long[] a = new long[n];

            //
            for (int i = 0; i < n; i++)
                a[i] = Math.Abs(long.Parse(s[i]) - x);

            if (n == 1)
            {
                Console.WriteLine(a[0]);
                return;
            }

            long ans = gcd(a[0], a[1]);

            for (int i = 2; i < n; i++)
                ans = gcd(ans, a[i]);

            //答え出力
            Console.WriteLine(ans);

        }

        /*最大公約数を求める関数*/
        static long gcd(long p, long q)
        {
            if (p < q)
            {
                long temp = p;
                p = q;
                q = temp;
            }

            long r = 1;

            while (r != 0)
            {
                r = p % q;
                p = q;
                q = r;
            }

            return p;
        }
    }

    class ProgramD
    {
        public void main()
        {

            //入力
            string[] input = Console.ReadLine().Split();
            long n = long.Parse(input[0]);
            long m = long.Parse(input[1]);

            long ans = 0;

            //2変数に分離
            for (int i = 1; i <= Math.Sqrt(m); i++)
            {
                if (m % i == 0)
                {
                    if (m / i >= n)
                        ans = i;
                }

            }

            //答え出力
            Console.WriteLine(ans);
           

        }
    }




  

}