public static void main ( String arg [ ] ) {
  Scanner sc = new Scanner ( System . in ) ;
  int d = sc . nextInt ( ) ;
  int sumhours = sc . nextInt ( ) ;
  int [ ] [ ] ar = new int [ d ] [ 2 ] ;
  int maxSum = 0 , minSum = 0 ;
  for ( int i = 0 ;
  i < d ;
  i ++ ) {
    ar [ i ] [ 0 ] = sc . nextInt ( ) ;
    ar [ i ] [ 1 ] = sc . nextInt ( ) ;
    maxSum += ar [ i ] [ 1 ] ;
    minSum += ar [ i ] [ 0 ] ;
  }
  if ( sumhours > maxSum || sumhours < minSum ) {
    System . out . println ( "NO" ) ;
    System . exit ( 0 ) ;
  }
  int [ ] dayHours = new int [ d ] ;
  for ( int i = 0 ;
  i < d ;
  i ++ ) {
    dayHours [ i ] = ar [ i ] [ 1 ] - ar [ i ] [ 0 ] ;
  }
  int [ ] res = new int [ d ] ;
  int temp = 0 ;
  for ( int i = 0 ;
  i < d ;
  i ++ ) {
    temp += ar [ i ] [ 0 ] ;
    res [ i ] = ar [ i ] [ 0 ] ;
  }
  System . out . println ( "YES" ) ;
  if ( ( temp == sumhours ) ) {
    for ( int i = 0 ;
    i < d ;
    i ++ ) {
      System . out . print ( res [ i ] + " " ) ;
    }
  }
  else {
    int req = sumhours - temp ;
    for ( int i = 0 ;
    i < d ;
    i ++ ) {
      if ( dayHours [ i ] - req >= 0 ) {
        res [ i ] += req ;
        break ;
      }
      else {
        req = req - dayHours [ i ] ;
        res [ i ] += dayHours [ i ] ;
      }
    }
    for ( int i = 0 ;
    i < d ;
    i ++ ) System . out . print ( res [ i ] + " " ) ;
  }
}

public static void main ( String arg [ ] ) { Scanner sc = new Scanner ( System . in ) ; int d = sc . nextInt ( ) ; int sumhours = sc . nextInt ( ) ; int [ ] [ ] ar = new int [ d ] [ 2 ] ; int maxSum = 0 , minSum = 0 ; for ( int i = 0 ; i < d ; i ++ ) { ar [ i ] [ 0 ] = sc . nextInt ( ) ; ar [ i ] [ 1 ] = sc . nextInt ( ) ; maxSum += ar [ i ] [ 1 ] ; minSum += ar [ i ] [ 0 ] ; } if ( sumhours > maxSum || sumhours < minSum ) { System . out . println ( " NO " ) ; System . exit ( 0 ) ; } int [ ] dayHours = new int [ d ] ; for ( int i = 0 ; i < d ; i ++ ) { dayHours [ i ] = ar [ i ] [ 1 ] - ar [ i ] [ 0 ] ; } int [ ] res = new int [ d ] ; int temp = 0 ; for ( int i = 0 ; i < d ; i ++ ) { temp += ar [ i ] [ 0 ] ; res [ i ] = ar [ i ] [ 0 ] ; } System . out . println ( " YES " ) ; if ( ( temp == sumhours ) ) { for ( int i = 0 ; i < d ; i ++ ) { System . out . print ( res [ i ] + " ▁ " ) ; } } else { int req = sumhours - temp ; for ( int i = 0 ; i < d ; i ++ ) { if ( dayHours [ i ] - req >= 0 ) { res [ i ] += req ; break ; } else { req = req - dayHours [ i ] ; res [ i ] += dayHours [ i ] ; } } for ( int i = 0 ; i < d ; i ++ ) System . out . print ( res [ i ] + " ▁ " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) 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 type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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 (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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (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 (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (if_statement condition: (parenthesized_expression (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) consequence: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (string_literal)))))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (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: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (break_statement)) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (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: (identifier)) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (string_literal))))))))))