public static void main ( String [ ] args ) {
  int n = scanner . nextInt ( ) ;
  long k = scanner . nextLong ( ) ;
  IntStream . range ( 0 , n ) . boxed ( ) . collect ( Collectors . toMap ( i -> scanner . nextInt ( ) , i -> scanner . nextLong ( ) , Long :: sum , TreeMap :: new ) ) . entrySet ( ) . stream ( ) . reduce ( k , ( rem , entry ) -> {
    if ( rem != null && ( rem -= entry . getValue ( ) ) <= 0 ) {
      System . out . println ( entry . getKey ( ) ) ;
      return null ;
    }
    return rem ;
  }, Long :: sum ) ;
}

public static void main ( String [ ] args ) { int n = scanner . nextInt ( ) ; long k = scanner . nextLong ( ) ; IntStream . range ( 0 , n ) . boxed ( ) . collect ( Collectors . toMap ( i -> scanner . nextInt ( ) , i -> scanner . nextLong ( ) , Long :: sum , TreeMap :: new ) ) . entrySet ( ) . stream ( ) . reduce ( k , ( rem , entry ) -> { if ( rem != null && ( rem -= entry . getValue ( ) ) <= 0 ) { System . out . println ( entry . getKey ( ) ) ; return null ; } return rem ; } , Long :: sum ) ; }
(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: (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)))) (expression_statement (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (lambda_expression parameters: (identifier) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (method_reference (identifier) (identifier)) (method_reference (identifier)))))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (identifier) (lambda_expression parameters: (inferred_parameters (identifier) (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (null_literal)) right: (binary_expression left: (parenthesized_expression (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (return_statement (null_literal)))) (return_statement (identifier)))) (method_reference (identifier) (identifier)))))))