public static void main ( String [ ] args ) {
  Scanner scanner = new Scanner ( System . in ) ;
  long [ ] nm = Arrays . stream ( scanner . nextLine ( ) . split ( " " ) ) . mapToLong ( Long :: parseLong ) . toArray ( ) ;
  if ( nm [ 1 ] == 0 ) {
    System . out . println ( nm [ 0 ] + " " + nm [ 0 ] ) ;
    return ;
  }
  long [ ] sums = new long [ ( int ) nm [ 0 ] + 2 ] ;
  for ( int i = 2 ;
  i <= nm [ 0 ] ;
  i ++ ) {
    sums [ i ] = ( long ) i * ( ( long ) i - 1 ) / 2 ;
  }
  long min = nm [ 0 ] / 2 >= nm [ 1 ] ? nm [ 0 ] - 2 * nm [ 1 ] : 0 ;
  int t = Math . abs ( Arrays . binarySearch ( sums , nm [ 1 ] ) ) ;
  if ( sums [ t ] != nm [ 1 ] ) t -- ;
  long max = nm [ 0 ] - t ;
  System . out . println ( min + " " + max ) ;
}

public static void main ( String [ ] args ) { Scanner scanner = new Scanner ( System . in ) ; long [ ] nm = Arrays . stream ( scanner . nextLine ( ) . split ( " ▁ " ) ) . mapToLong ( Long :: parseLong ) . toArray ( ) ; if ( nm [ 1 ] == 0 ) { System . out . println ( nm [ 0 ] + " ▁ " + nm [ 0 ] ) ; return ; } long [ ] sums = new long [ ( int ) nm [ 0 ] + 2 ] ; for ( int i = 2 ; i <= nm [ 0 ] ; i ++ ) { sums [ i ] = ( long ) i * ( ( long ) i - 1 ) / 2 ; } long min = nm [ 0 ] / 2 >= nm [ 1 ] ? nm [ 0 ] - 2 * nm [ 1 ] : 0 ; int t = Math . abs ( Arrays . binarySearch ( sums , nm [ 1 ] ) ) ; if ( sums [ t ] != nm [ 1 ] ) t -- ; long max = nm [ 0 ] - t ; System . out . println ( min + " ▁ " + max ) ; }
(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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) name: (identifier) arguments: (argument_list (method_reference (identifier) (identifier)))) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (string_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))))) (return_statement))) (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: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (decimal_integer_literal))) 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: (array_access array: (identifier) index: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (binary_expression left: (cast_expression type: (integral_type) value: (identifier)) right: (parenthesized_expression (binary_expression left: (cast_expression type: (integral_type) value: (identifier)) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (ternary_expression condition: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) consequence: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (binary_expression left: (decimal_integer_literal) right: (array_access array: (identifier) index: (decimal_integer_literal)))) alternative: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (decimal_integer_literal)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (decimal_integer_literal)))) consequence: (expression_statement (update_expression (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)))))))