Search key K in a sorted array A of unknown length