# your code goes here
from random import randint

def swap(A,i,j):
    temp = A[i]
    A[i] = A[j]
    A[j] = temp

def Partition(A,lb,ub):
    Pivot = A[lb]
    start = lb
    end = ub
    while(start < end):
        while(A[start] <= Pivot):
            start+=1
        while(A[end] > Pivot):
            end-=1
        if(start < end):
            swap(A,start,end)
    swap(A,lb,end)
    return end

def QuickSort(A,lb,ub):
    if(lb < ub):
        loc = Partition(A,lb,ub)
        QuickSort(A,lb,loc - 1)
        QuickSort(A,loc+1,ub)

n=int(input())
m=int(input())

A = [];

for k in range(n):
    A.append(randint(0,m))

print(A)

QuickSort(A,0,len(A)-1)

print(A)


while A:
    A.pop()