media of two sorted array, binary search, painful algorithm