static void solve ( ) {
  int d = ni ( ) , st = ni ( ) ;
  int mins = 0 ;
  int maxs = 0 ;
  int [ ] min = new int [ d ] ;
  int [ ] max = new int [ d ] ;
  for ( int i = 0 ;
  i < d ;
  ++ i ) {
    min [ i ] = ni ( ) ;
    max [ i ] = ni ( ) ;
    mins = mins + min [ i ] ;
    maxs = maxs + max [ i ] ;
  }
  if ( st < mins || st > maxs ) {
    out ( "NO" ) ;
  }
  else {
    out ( "YES" ) ;
    if ( st == mins ) {
      for ( int e : min ) {
        ou ( e + " " ) ;
      }
    }
    else {
      int rem = st - mins ;
      for ( int i = 0 ;
      i < d ;
      ++ i ) {
        if ( rem <= ( max [ i ] - min [ i ] ) ) {
          min [ i ] = min [ i ] + rem ;
          rem = 0 ;
          break ;
        }
        else {
          rem = rem - ( max [ i ] - min [ i ] ) ;
          min [ i ] = max [ i ] ;
        }
      }
      for ( int e : min ) {
        ou ( e + " " ) ;
      }
    }
  }
}

static void solve ( ) { int d = ni ( ) , st = ni ( ) ; int mins = 0 ; int maxs = 0 ; int [ ] min = new int [ d ] ; int [ ] max = new int [ d ] ; for ( int i = 0 ; i < d ; ++ i ) { min [ i ] = ni ( ) ; max [ i ] = ni ( ) ; mins = mins + min [ i ] ; maxs = maxs + max [ i ] ; } if ( st < mins || st > maxs ) { out ( " NO " ) ; } else { out ( " YES " ) ; if ( st == mins ) { for ( int e : min ) { ou ( e + " ▁ " ) ; } } else { int rem = st - mins ; for ( int i = 0 ; i < d ; ++ i ) { if ( rem <= ( max [ i ] - min [ i ] ) ) { min [ i ] = min [ i ] + rem ; rem = 0 ; break ; } else { rem = rem - ( max [ i ] - min [ i ] ) ; min [ i ] = max [ i ] ; } } for ( int e : min ) { ou ( e + " ▁ " ) ; } } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list)))) (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: (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: (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: (method_invocation name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) (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 name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (string_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (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: (identifier) right: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement)) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (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)))))))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))))))))))