x, n = [int(x) for x in input().split()]
food = [int(x) for x in input().split()] + [x]
food.sort()
if food.index(x) >= len(food) // 2:
print(f"{food.index(x)} {food[0]}")
else:
print(f"{len(food) - food.index(x) - 1} {food[-1]}")
x, n = [int(x) for x in input().split()]
food = [int(x) for x in input().split()] + [x]
food.sort()if food.index(x) >= len(food) // 2:
print(f"{food.index(x)} {food[0]}")
else:
print(f"{len(food) - food.index(x) - 1} {food[-1]}")
感覺python可以寫很簡潔耶