n, k = map(int, input().split())
arr = list(map(int, input().split()))
i, j = 0, n - 1
re = set()
while i < j:
if arr[i] + arr[j] == k:
if (arr[i], arr[j]) not in re:
re.add((arr[i], arr[j]))
print(arr[i], arr[j])
j -= 1
elif arr[i] + arr[j] > k:
j -= 1
else:
i += 1