Use NumPy functions to search the arrays (remove all loops)