use binary search method to get k maximum element