#55046: 我也不知道為甚麼能跑 非常直覺的py解


vesst (ves)


x,n = map(int,input().split())
f = list(map(int,input().split()))
 
f.append(x)
f.sort()

 

count =[] #儲存最多食物的邊

 

for i in range(len(f)):
    if f[i] == x:
        line = (len(f)) - i
        if len(f) // 2 < line:#如果右側較多
            for j in range(i+1,len(f)):
                count.append(f[j])
                res = count[-1]#直接輸出最後一位

 

        elif len(f) // 2 >= line:#如果左側較多
            for k in range(0,i):
                count.append(f[k])
                res = count[0]#直接輸出第一位

 

print(len(count),res)