(function(input) {
  'use strict';
  const lines = input.split("\n")
  lines.forEach(line => {
    if (!line) return
    const NM = line.split(' ')
    const N = NM[0]
    const M = NM[1]

    const MaxD = Math.floor(M/N)

    let i = MaxD

    while(i){
      if (M%i === 0) {
        console.log(i)
        break;
      }
      i--
    }
  })
})(require('fs').readFileSync('/dev/stdin', 'utf8'))