public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int N = sc . nextInt ( ) ;
  int M = sc . nextInt ( ) ;
  final int m = ( int ) Math . sqrt ( M ) ;
  boolean [ ] prm = new boolean [ m + 1 ] ;
  for ( int i = 2 ;
  i < m + 1 ;
  i ++ ) prm [ i ] = true ;
  for ( int i = 2 ;
  i < m + 1 ;
  i ++ ) {
    if ( prm [ i ] ) {
      for ( int j = 2 * i ;
      j < m + 1 ;
      j += i ) prm [ j ] = false ;
    }
  }
  int [ ] L1 = new int [ m + 1 ] ;
  int [ ] L2 = new int [ m + 1 ] ;
  int id = 0 ;
  int M2 = M ;
  for ( int i = 2 ;
  i < m + 1 ;
  i ++ ) {
    if ( prm [ i ] && M2 % i == 0 ) {
      L1 [ id ] = i ;
      while ( M2 % i == 0 ) {
        L2 [ id ] ++ ;
        M2 /= i ;
      }
      id ++ ;
    }
    if ( i == m && M2 > 1 ) {
      L1 [ id ] = M2 ;
      L2 [ id ] ++ ;
      id ++ ;
    }
  }
  int p = solve ( 1 , L1 , L2 , 0 , N , id ) ;
  System . out . println ( M / p ) ;
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int N = sc . nextInt ( ) ; int M = sc . nextInt ( ) ; final int m = ( int ) Math . sqrt ( M ) ; boolean [ ] prm = new boolean [ m + 1 ] ; for ( int i = 2 ; i < m + 1 ; i ++ ) prm [ i ] = true ; for ( int i = 2 ; i < m + 1 ; i ++ ) { if ( prm [ i ] ) { for ( int j = 2 * i ; j < m + 1 ; j += i ) prm [ j ] = false ; } } int [ ] L1 = new int [ m + 1 ] ; int [ ] L2 = new int [ m + 1 ] ; int id = 0 ; int M2 = M ; for ( int i = 2 ; i < m + 1 ; i ++ ) { if ( prm [ i ] && M2 % i == 0 ) { L1 [ id ] = i ; while ( M2 % i == 0 ) { L2 [ id ] ++ ; M2 /= i ; } id ++ ; } if ( i == m && M2 > 1 ) { L1 [ id ] = M2 ; L2 [ id ] ++ ; id ++ ; } } int p = solve ( 1 , L1 , L2 , 0 , N , id ) ; System . out . println ( M / p ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (local_variable_declaration type: (array_type element: (boolean_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (boolean_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (true)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (array_access array: (identifier) index: (identifier))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (identifier)))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (assignment_expression left: (identifier) right: (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (false)))))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) body: (block (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) (expression_statement (update_expression (identifier))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier) (identifier) (decimal_integer_literal) (identifier) (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))))