import sys

n,k = map(int,input().split())
arr = list(map(int,input().split()))
for i in range(0,n):
    if i > 0 and arr[i] == arr[i-1]:
        continue
    left = i+1
    right = n-1
    while left < right:
        if arr[i] +arr[left] + arr[right] < k:
            left += 1
        elif arr[i] +arr[left] + arr[right]== k:
            if arr[i] < arr[left] and arr[left] < arr[right]:
                print(arr[i],arr[left], arr[right])
            if arr[left] == arr[left+1]:
                left += 1
            if arr[right] == arr[right-1]:
                right -= 1
            left += 1
            right -= 1
        elif arr[i] +arr[left] + arr[right] > k:
            right -= 1