Floor of first element is - 1 if there is only one occurrence of it .
if ( arr [ i ] == v [ 0 ] ) { ( arr [ i ] == v [ 1 ] ) ? document . write ( arr [ i ] ) : document . write ( - 1 ) ; document . write ( " " ) ; continue ; }