x, y = list(map(int, input().split()))
arr = list(map(int, input().split()))


def bubble_sort(arr):
    change = True
    while(change):
        change = False
        if(1 <= x, y <= 1000 and 1 <= max(arr) <= 1000 and 1 <= min(arr) <= 1000):
            for i in range(len(arr) - 1):
                if arr[i] > arr[i + 1]:
                    arr[i], arr[i + 1] = arr[i + 1], arr[i]
                    change = True
    return arr


sorted_list = bubble_sort(arr)

result = sorted_list[0] + sorted_list[1] + sorted_list[2]

print(result)