Made y = 0 to stop iterating over array after finding result