import sys
from collections import namedtuple
n, m = str(sys.stdin.read()).split( )
n = int(n)
m = int(m)
def dfs(start, n, sum, status):
if sum == m:
res = filter(lambda x: status >> x & 1 == 1, range(n))
print ' '.join(map(lambda x: str(x + 1), res))
elif n - start + sum >= m:
dfs(start + 1, n, sum + 1, status | 1 << start)
dfs(start + 1, n, sum, status)
# dfs(0, n, 0, 0)
Location = namedtuple('Location', ['pos', 'start', 'sum', 'status'])
stack = list()
l = Location(0, 0, 0, 0)
stack.append(l)
while len(stack) != 0:
l = stack[-1]
stack.pop()
if l.pos == 0:
if l.sum == m:
res = filter(lambda x: l.status >> x & 1, range(n))
print ' '.join(map(lambda x : str(x+1), res))
elif n - l.start + l.sum >= m:
stack.append(Location(1, l.start, l.sum, l.status))
stack.append(Location(0, l.start+1, l.sum+1, l.status | 1 << l.start))
elif l.pos == 1:
stack.append(Location(2, l.start, l.sum, l.status))
stack.append(Location(0, l.start+1, l.sum, l.status))
elif l.pos == 2:
pass