If you don't want to sort them, you could use an array of piles or a map, then read the first vector, increment the counter for each element respectively, then read the second vector, decrement the counter for each element and see if all the counters are zero at the end.