public static void main ( String [ ] args ) throws FileNotFoundException {
  Scanner input = new Scanner ( System . in ) ;
  int n = input . nextInt ( ) ;
  int m = input . nextInt ( ) ;
  int DorU [ ] = new int [ n + m ] ;
  TreeMap < Integer , Integer > map = new TreeMap < > ( ) ;
  int all [ ] = new int [ n + m ] ;
  for ( int i = 0 ;
  i < n + m ;
  i ++ ) {
    all [ i ] = input . nextInt ( ) ;
  }
  for ( int i = 0 ;
  i < n + m ;
  i ++ ) {
    DorU [ i ] = input . nextInt ( ) ;
    if ( DorU [ i ] == 1 ) {
      map . put ( all [ i ] , 0 ) ;
    }
  }
  for ( int i = 0 ;
  i < n + m ;
  i ++ ) {
    if ( DorU [ i ] == 0 ) {
      int res = - 1 ;
      if ( all [ i ] < map . firstKey ( ) ) {
        res = map . ceilingKey ( all [ i ] ) ;
      }
      else if ( all [ i ] > map . lastKey ( ) ) {
        res = map . floorKey ( all [ i ] ) ;
      }
      else {
        int left = map . floorKey ( all [ i ] ) ;
        int right = map . ceilingKey ( all [ i ] ) ;
        if ( Math . abs ( left - all [ i ] ) <= Math . abs ( right - all [ i ] ) ) {
          res = left ;
        }
        else res = right ;
      }
      map . put ( res , map . getOrDefault ( res , 0 ) + 1 ) ;
    }
  }
  for ( int i = 0 ;
  i < n + m ;
  i ++ ) {
    if ( DorU [ i ] == 1 ) {
      System . out . print ( map . get ( all [ i ] ) + " " ) ;
    }
  }
  System . out . println ( "" ) ;
}

public static void main ( String [ ] args ) throws FileNotFoundException { Scanner input = new Scanner ( System . in ) ; int n = input . nextInt ( ) ; int m = input . nextInt ( ) ; int DorU [ ] = new int [ n + m ] ; TreeMap < Integer , Integer > map = new TreeMap < > ( ) ; int all [ ] = new int [ n + m ] ; for ( int i = 0 ; i < n + m ; i ++ ) { all [ i ] = input . nextInt ( ) ; } for ( int i = 0 ; i < n + m ; i ++ ) { DorU [ i ] = input . nextInt ( ) ; if ( DorU [ i ] == 1 ) { map . put ( all [ i ] , 0 ) ; } } for ( int i = 0 ; i < n + m ; i ++ ) { if ( DorU [ i ] == 0 ) { int res = - 1 ; if ( all [ i ] < map . firstKey ( ) ) { res = map . ceilingKey ( all [ i ] ) ; } else if ( all [ i ] > map . lastKey ( ) ) { res = map . floorKey ( all [ i ] ) ; } else { int left = map . floorKey ( all [ i ] ) ; int right = map . ceilingKey ( all [ i ] ) ; if ( Math . abs ( left - all [ i ] ) <= Math . abs ( right - all [ i ] ) ) { res = left ; } else res = right ; } map . put ( res , map . getOrDefault ( res , 0 ) + 1 ) ; } } for ( int i = 0 ; i < n + m ; i ++ ) { if ( DorU [ i ] == 1 ) { System . out . print ( map . get ( all [ i ] ) + " ▁ " ) ; } } System . out . println ( " " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_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 type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (identifier)))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (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: (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 object: (identifier) name: (identifier) arguments: (argument_list)))))) (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: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)) (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: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (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: (binary_expression left: (identifier) right: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) 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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))) right: (string_literal))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))