public static void main ( String args [ ] ) {
  FastScanner in = new FastScanner ( ) ;
  int n = in . nextInt ( ) ;
  int m = in . nextInt ( ) ;
  long a [ ] = new long [ n + m + 2 ] ;
  long b [ ] = new long [ n + m + 2 ] ;
  a [ 0 ] = ( int ) ( - Math . pow ( 10 , 15 ) ) ;
  a [ n + m + 1 ] = ( int ) ( Math . pow ( 10 , 15 ) ) ;
  b [ 0 ] = b [ n + m + 1 ] = 1 ;
  for ( int i = 1 ;
  i < n + m + 1 ;
  i ++ ) a [ i ] = in . nextLong ( ) ;
  for ( int i = 1 ;
  i < n + m + 1 ;
  i ++ ) b [ i ] = in . nextLong ( ) ;
  int ind = 0 ;
  long c [ ] = new long [ n + m + 2 ] ;
  long d [ ] = new long [ n + m + 2 ] ;
  d [ 0 ] = 1 ;
  for ( int i = 1 ;
  i < n + m + 2 ;
  i ++ ) {
    d [ i ] = d [ i - 1 ] + b [ i ] ;
    if ( b [ i ] == 1 ) {
      c [ ind ] = i ;
      ind = i ;
    }
  };
}

public static void main ( String args [ ] ) { FastScanner in = new FastScanner ( ) ; int n = in . nextInt ( ) ; int m = in . nextInt ( ) ; long a [ ] = new long [ n + m + 2 ] ; long b [ ] = new long [ n + m + 2 ] ; a [ 0 ] = ( int ) ( - Math . pow ( 10 , 15 ) ) ; a [ n + m + 1 ] = ( int ) ( Math . pow ( 10 , 15 ) ) ; b [ 0 ] = b [ n + m + 1 ] = 1 ; for ( int i = 1 ; i < n + m + 1 ; i ++ ) a [ i ] = in . nextLong ( ) ; for ( int i = 1 ; i < n + m + 1 ; i ++ ) b [ i ] = in . nextLong ( ) ; int ind = 0 ; long c [ ] = new long [ n + m + 2 ] ; long d [ ] = new long [ n + m + 2 ] ; d [ 0 ] = 1 ; for ( int i = 1 ; i < n + m + 2 ; i ++ ) { d [ i ] = d [ i - 1 ] + b [ i ] ; if ( b [ i ] == 1 ) { c [ ind ] = i ; ind = 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)))) (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: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (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: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (cast_expression type: (integral_type) value: (parenthesized_expression (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal)))))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) right: (cast_expression type: (integral_type) value: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (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: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (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: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) 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) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (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: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (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: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (array_access array: (identifier) index: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (identifier)))))))))