#38046: Python 7行解~


110637@st.tysh.tyc.edu.tw (ronron)


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]}")

#38224: Re: Python 7行解~


bobobo0413 (Andy)


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可以寫很簡潔耶