When there is an -1 somewhere, all rows are only evaluated if the -1 is at the last row. Otherwise, the search is aborted as soon as the first -1 is seen.