Permutation p is an ordered set of integers p_1,  p_2,  ...,  p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as p_{i}. We'll call number n the size or the length of permutation p_1,  p_2,  ...,  p_{n}.

The decreasing coefficient of permutation p_1, p_2, ..., p_{n} is the number of such i (1 ≤ i < n), that p_{i} > p_{i} + 1.

You have numbers n and k. Your task is to print the permutation of length n with decreasing coefficient k.


-----Input-----

The single line contains two space-separated integers: n, k (1 ≤ n ≤ 10^5, 0 ≤ k < n) — the permutation length and the decreasing coefficient.


-----Output-----

In a single line print n space-separated integers: p_1, p_2, ..., p_{n} — the permutation of length n with decreasing coefficient k. 

If there are several permutations that meet this condition, print any of them. It is guaranteed that the permutation with the sought parameters exists.


-----Examples-----
Input
5 2

Output
1 5 2 4 3

Input
3 0

Output
1 2 3

Input
3 2

Output
3 2 1

Source: codeforces | Difficulty: EASY
Tags: Implementation

Greedy algorithms


Solutions:
(n, k) = map(int, input().split())
i = -1
for i in range(k):
	print(n - i, end=' ')
for i in range(i + 1, n):
	print(i - k + 1, end=' ')


(n, k) = map(int, input().split())
arr = [int(i) for i in range(1, n + 1)]
arr1 = arr[:k + 1]
arr1.sort(reverse=True)
arr2 = arr[k + 1:]
print(*arr1, end=' ')
if len(arr2) != 0:
	print(*arr2)


(n, k) = map(int, input().split())
i = 1
e = n - k - 1
while i <= e:
	print(i, end=' ')
	i += 1
while k >= 0:
	print(n, end=' ')
	n -= 1
	k -= 1


[n, k] = [int(item) for item in input().split(' ')]
increasing = range(1, n + 1)
decreasing = reversed(increasing)
index = 0
seq = []
for item in decreasing:
	if index >= k:
		break
	index += 1
	seq.append(item)
for item in increasing:
	if index >= n:
		break
	index += 1
	seq.append(item)
print(' '.join(map(str, seq)))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import deque
(n, k) = map(int, input().split())
nums = deque(list(range(1, n + 1)))
ans = []
while k > 0:
	ans.append(nums.pop())
	k -= 1
while len(nums) > 0:
	ans.append(nums.popleft())
print(*ans)


(n, k) = map(int, input().split())
l = []
for i in range(1, n + 1):
	l.append(i)
s = l[:n - k]
r = l[n - k:]
r.sort(reverse=True)
print(*r + s)


import sys
my_file = sys.stdin
nums = [int(i) for i in my_file.readline().split(' ')]
n = nums[0]
k = nums[1]
p = list(range(1, n + 1))
p = p[n - 1:n - k - 1:-1] + p[:n - k]
for i in p:
	print(i, end=' ')


(n, k) = map(int, input().split())
ans = list(range(1, n + 1))
ans[:k + 1] = ans[:k + 1][::-1]
print(*ans)


(n, k) = map(int, input().strip().split())
res = [''] * n
for i in range(n - k - 1):
	res[i] = str(i + 1)
diff = n - 1
for i in range(n - k - 1, n):
	res[diff] = str(i + 1)
	diff -= 1
print(' '.join(res))


import math
for _ in range(1):
	(n, k) = map(int, input().split())
	for i in range(k + 1, 0, -1):
		print(i, end=' ')
	for j in range(k + 2, n + 1):
		print(j, end=' ')


def f():
	A = list(map(int, input().split()))
	n = A[0]
	k = A[1]
	for i in range(n, n - k, -1):
		print(i, end=' ')
	for i in range(1, n - k + 1):
		print(i, end=' ')
f()


(n, k) = map(int, input().split())
a = list(range(n, n - k, -1))
a += list(range(1, n - k + 1))
print(*a)


(a, b) = [int(i) for i in input().split()]
l = list(range(1, a + 1))[::-1]
print(*l[0:b] + l[b:][::-1])


import math
from bisect import bisect_left, bisect, bisect_right
from itertools import accumulate

def index(a, x):
	i = bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	raise ValueError

def find_lt(a, x):
	i = bisect_left(a, x)
	if i:
		return a[i - 1]
	raise ValueError

def find_le(a, x):
	i = bisect_right(a, x)
	if i:
		return a[i - 1]
	raise ValueError

def find_gt(a, x):
	i = bisect_right(a, x)
	if i != len(a):
		return a[i]
	raise ValueError

def find_ge(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		return a[i]
	raise ValueError
st = ''

def func(n, k):
	l = [i for i in range(1, n + 1)]
	s = ''
	i = 0
	l1 = []
	if k == 0:
		print(*l)
	elif k == n - 1:
		print(*l[::-1])
	else:
		l1.extend(l[n - k:])
		l1.reverse()
		l1.extend(l[:-k])
		print(*l1)
for _ in range(1):
	(n, m) = map(int, input().split())
	func(n, m)
print(st)


(a, b) = map(int, input().split())
for i in range(a, a - b, -1):
	print(i, end=' ')
for i in range(1, a - b + 1):
	print(i, end=' ')


s = input().split()
(n, k) = map(int, s)
l = []
for i in range(1, n - k):
	l.append(i)
for i in reversed(range(n - k, n + 1)):
	l.append(i)
for x in l:
	print(x, end=' ')


(n, k) = map(int, input().strip().split())
a = list(range(1, n + 1))
a[:k + 1] = a[k::-1]
a = [str(i) for i in a]
print(' '.join(a))


ss = lambda : input()
si = lambda : int(input())
(n, k) = map(int, ss().split())
s = list(range(1, n + 1))
print(*s[:n - k - 1] + list(reversed(s[n - k - 1:])))


(n, k) = map(int, input().split(' '))
perm = [0 for i in range(n)]
num = n
j = 1
for i in range(k):
	perm[n - i - 1] = j
	j += 1
for i in range(n - k - 1, -1, -1):
	perm[i] = num
	num -= 1
for p in perm:
	print(p, end=' ')


(n, k) = map(int, input().strip().split(' '))
if k == 0:
	for j in range(n):
		print(j + 1, end=' ')
elif k == n - 1:
	for j in range(n):
		print(n - j, end=' ')
else:
	c = 0
	r = 0
	while r <= n - k:
		if c < k:
			print(n - c, end=' ')
			c += 1
			if c == k:
				r = 1
		else:
			print(r, end=' ')
			r += 1


(n, k) = map(int, input().split())
print(*list(range(k + 1, 0, -1)) + [i + k for i in range(2, n - k + 1)])


(n, k) = map(int, input().split())
a = list(range(n + 1))
f = a[1:n - k + 1]
d = a[-1:-k - 1:-1]
print(' '.join(map(str, d)) + ' ' * (len(f) > 0 and len(d) > 0) + ' '.join(map(str, f)))


(n, k) = map(int, input().split())
if k == 0:
	lst1 = []
	for b in range(1, n + 1):
		lst1.append(b)
	res1 = [str(r) for r in lst1]
	print(' '.join(res1))
else:
	lst = []
	for x in range(k):
		lst.append(n - x)
	for y in range(k, n):
		lst.append(y - k + 1)
	res = [str(b) for b in lst]
	print(' '.join(res))


(n, k) = [int(i) for i in input().split()]
print(' '.join([str(n + 1 - i) if i <= k else str(i - k) for i in range(1, n + 1)]))


(n, k) = map(int, input().split())
l = []
for i in range(k):
	l.append(n - i)
for i in range(1, n - k + 1):
	l.append(i)
print(*l)


inp = input().split()
n = int(inp[0])
k = int(inp[1])
ans = []
for i in range(n, n - k, -1):
	ans.append(i)
for i in range(1, n - k + 1):
	ans.append(i)
a = ''
for i in range(len(ans)):
	a += str(ans[i])
	if i != len(ans) - 1:
		a += ' '
print(a)


def main():
	(n, k) = map(int, input().split())
	arr = [*range(k + 1, 0, -1), *range(k + 2, n + 1)]
	print(*arr)
main()


import sys
lines = []
for line in sys.stdin:
	lines.append(line.rstrip('\n'))
(n, k) = map(int, lines[0].split(' '))
nbrs = list(range(1, n + 1))
answer = []
for i in range(1, n - k):
	answer.append(i)
for i in range(n - k, n + 1):
	answer.append(2 * n - k - i)
print(' '.join(map(str, answer)))


def go():
	(n, k) = [int(i) for i in input().split(' ')]
	x = 0
	o = []
	for i in range(n, n - k, -1):
		o.append(str(i))
	o += [str(i) for i in range(1, n - k + 1)]
	return ' '.join(o)
print(go())


(n, k) = [int(i) for i in input().split()]
p = list(range(1, n - k)) + list(range(max(n - k, 1), n + 1))[::-1]
print(' '.join([str(i) for i in p]))


(n, k) = map(int, input().split())
if k == 0:
	print(*[i for i in range(1, n + 1)])
else:
	arr = [n]
	t = 0
	for i in range(n - 1, 0, -1):
		if t == k - 1:
			break
		arr.append(i)
		t += 1
	for i in range(1, arr[-1]):
		arr.append(i)
	print(*arr)


(n, k) = map(int, input().split(' '))
a = [str(i) for i in range(1, n + 1)]
if k != 0:
	a = list(reversed(a[-k:])) + a[:-k]
print(' '.join(a))


import math
import collections
from itertools import permutations
from itertools import combinations

def prob():
	(n, k) = [int(x) for x in input().split()]
	ans = [i for i in range(1, n + 1)]
	if k == 0:
		print(*ans)
		return
	print(*ans[-k:][::-1] + ans[:-k])
t = 1
for _ in range(0, t):
	prob()


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, k) = rinput()
a = []
for i in range(n, n - k, -1):
	a.append(i)
for i in range(1, n - k + 1):
	a.append(i)
print(*a)


(n, k) = [int(x) for x in input().strip().split()]
l = list(range(1, n + 1))
if k == n - 1:
	print(' '.join([str(x) for x in l[::-1]]))
elif k == 0:
	print(' '.join([str(x) for x in l]))
else:
	l = l[:n - k - 1] + l[n - k - 1:][::-1]
	print(' '.join([str(x) for x in l]))


string = input()
values = string.split()
(a, b) = (int(values[0]), int(values[1]))
numbers = [x for x in range(1, a + 1)]
numbers[:b + 1] = numbers[:b + 1][::-1]
print(' '.join(map(str, numbers)))


(n, k) = map(int, input().split())
l = []
for i in range(1, n + 1):
	l.append(i)
l1 = l[0:n - k - 1]
l.reverse()
for i in range(k + 1):
	l1.append(l[i])
for i in l1:
	print(i, end=' ')


I = lambda : list(map(int, input().split()))
(n, m) = I()
l = list(range(1, n + 1))
temp = l[:m + 1]
l = temp[::-1] + l[m + 1:]
print(*l)


(n, k) = map(int, input().strip().split())
L = []
for i in range(1, n + 1):
	L.append(i)
for i in range(k):
	print(L[n - 1 - i], end=' ')
for i in range(n - k):
	print(L[i], end=' ')


def solve(n, k):
	arr = list(range(1, n + 1))
	if n - k == 1:
		return list(reversed(arr))
	return arr[:n - k - 1] + list(reversed(arr[n - k - 1:]))

def main():
	a = list(map(int, input().split(' ')))
	print(*solve(*a))
main()


nk = input().split()
n = int(nk[0])
k = int(nk[1])
for i in range(1, n - k):
	print(i, end=' ')
for i in range(n, n - k - 1, -1):
	print(i, end=' ')


import sys
(n, k) = [int(x) for x in sys.stdin.readline().split()]
j = 0
result = []
for i in range(n, 0, -1):
	if j < k:
		result.append(str(i))
		j += 1
	else:
		break
for i in range(1, n - k + 1):
	result.append(str(i))
print(' '.join(result))


l = list(map(int, input().split()))
while l[1]:
	print(l[0], end=' ')
	l[1] -= 1
	l[0] -= 1
for i in range(1, l[0] + 1):
	print(i, end=' ')


(n, k) = map(int, input().split())
for x in list(reversed(range(1, n + 1)[:k + 1])) + list(range(1, n + 1)[k + 1:]):
	print(str(x) + ' ')


(a, b) = list(map(int, input().split()))
for i in list(range(b + 1, 0, -1)) + list(range(b + 2, a + 1)):
	print(i, end=' ')


s = list(map(int, input().split()))
for i in range(s[1] + 1, 0, -1):
	print(str(i) + ' ', end='')
for i in range(s[1] + 1, s[0], 1):
	print(str(i + 1) + ' ', end='')


a = list(map(int, input().split()))
print(' '.join(map(str, range(1, a[1] + 2)[::-1])), ' '.join(map(str, range(a[1] + 2, a[0] + 1))))


(n, k) = map(int, input().split())
r = range(1, n + 1)
print(*r[:-k - 1], *r[-k - 1:][::-1])


def main():
	(n, k) = map(int, input().strip().split())
	return list(range(n, n - k, -1)) + list(range(1, n - k + 1))
print(*main())


def solution():
	(n, k) = map(int, input().split())
	arr = [i for i in range(1, n + 1)]
	sol = []
	while k:
		sol.append(arr.pop())
		k -= 1
	sol += arr
	print(*sol)
	return
solution()


def permutation(n, k):
	m = [i for i in range(1, n + 1)]
	p = m[::-1]
	result = p[:k] + m[:n - k]
	return result
temp = list(map(int, input().rstrip().split()))
n = temp[0]
k = temp[1]
result = str()
temp = permutation(n, k)
for i in temp:
	result += str(i) + ' '
print(result.rstrip())


sa = input().split(' ')
nums = int(sa[0])
decs = int(sa[1])
string = ''
for x in range(nums, nums - decs, -1):
	string += str(x)
	string += ' '
for x in range(1, nums - decs + 1):
	string += str(x)
	string += ' '
print(string.strip())


import sys
(n, k) = map(int, input().split())
a = list(range(1, k + 2))[::-1] + list(range(k + 2, n + 1))
print(*a)


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
from math import inf

def main():
	try:
		(n, m) = invr()
		a = [i for i in range(1, n + 1)]
		print(*sorted(a[:m + 1], reverse=True) + a[m + 1:], sep=' ')
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, input().split()))
for _ in range(1):
	(n, k) = lst()
	while k > 0:
		stdout.write(str(n) + ' ')
		n -= 1
		k -= 1
	for i in range(1, n + 1):
		stdout.write(str(i) + ' ')


rd = lambda : list(map(int, input().split()))
(n, k) = rd()
print(' '.join(map(str, list(range(n, n - k, -1)) + list(range(1, n - k + 1)))))


(n, k) = map(int, input().split())
L = list(range(1, n + 1))
if k != 0:
	i = -k + n
	s = L[-k:-1] + [L[-1]]
	s.reverse()
	L = s + L[:i]
for i in range(n - 1):
	print(L[i], end=' ')
print(L[-1])


(n, k) = map(int, input().split())
for i in range(k + 1, 0, -1):
	print(i, end=' ')
for j in range(k + 2, n + 1):
	print(j, end=' ')


arr = input().split()
n = int(arr[0])
k = int(arr[1])
j = 1
ans = ''
ptr = n
for i in range(k):
	ans += str(ptr)
	ans += ' '
	ptr -= 1
n -= k
for i in range(n):
	ans += str(j)
	ans += ' '
	j += 1
print(ans)


(n, k) = map(int, input().split())
arr = [str(a) for a in range(1, n + 1)]
arr1 = [str(a) for a in range(n, n - k, -1)]
arr2 = [str(a) for a in range(1, n - k + 1)]
if k == 0:
	print(' '.join(arr))
else:
	print(' '.join(arr1 + arr2))


(n, k) = [int(x) for x in input().split()]
if n // 2 >= k:
	arr = list(range(1, n + 1))
	c = 0
	for i in range(0, n - 1, 2):
		if c == k:
			break
		(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
		c += 1
else:
	arr = list(reversed(range(1, n + 1)))
	c = n - 1
	for i in range(0, n - 1, 2):
		if c == k:
			break
		(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
		c -= 1
for x in arr:
	print(x, end=' ')


(n, k) = map(int, input().split())
(l, r) = (list, range)
a = l(r(n, n - k, -1)) + l(r(1, n - k + 1))
print(' '.join(map(str, a)))


(n, k) = list(map(int, input().split()))
mass = [i for i in range(1, n + 1)]
mass_r = mass[:k + 1][::-1]
ans = mass_r + mass[k + 1:]
print(*ans)


import sys
input = sys.stdin.buffer.readline

def printer(ipos, x):
	for i in range(ipos, x):
		print(i, end=' ')
(n, k) = map(int, input().split())
if k == 0:
	printer(1, n + 1)
else:
	for i in range(k + 1, 0, -1):
		print(i, end=' ')
	printer(k + 2, n + 1)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
(n, k) = In()
arr = [i for i in range(1, n + 1)]
if k == 0:
	for i in arr:
		print(i, end=' ')
elif k == n - 1:
	arr.sort(reverse=True)
	for i in arr:
		print(i, end=' ')
else:
	if k <= n // 2:
		i = n - 1
		while k != 0:
			tmp = arr[i]
			arr[i] = arr[i - 1]
			arr[i - 1] = tmp
			i -= 2
			k -= 1
	else:
		arr.sort(reverse=True)
		i = n - 1
		k = n - k - 1
		while k != 0:
			tmp = arr[i]
			arr[i] = arr[i - 1]
			arr[i - 1] = tmp
			i -= 2
			k -= 1
	for i in arr:
		print(i, end=' ')


(n, k) = [int(x) for x in input().split()]
ans = []
last = n
idx = 0
while idx != k:
	ans.append(last)
	last -= 1
	idx += 1
start = 1
while start <= last:
	ans.append(start)
	start += 1
print(*ans)


(a, b) = map(int, input().split())
seq = [x + 1 for x in range(a)]
if a > b + 1:
	seq = seq[:a - b - 1] + seq[:a - b - 2:-1]
else:
	seq = seq[::-1]
print(*seq, sep=' ')


(n, m) = map(int, input().split())
l = [i for i in range(1, n + 1)]
p = l[m::-1]
p.extend(l[m + 1:n])
for i in p:
	print(i, end=' ')


(n, k) = map(int, input().split())
l = list(range(1, n + 1))
index = n - 1 - k
p = l[index:][::-1]
l = l[:index] + p
for i in l:
	print(i, end=' ')


def permutations(n, k):
	if k == 0:
		return list(range(1, n + 1))
	a = list()
	for i in range(n, n - k, -1):
		a.append(i)
	for i in range(n - k):
		a.append(i + 1)
	return a
(N, K) = [int(j) for j in input().split()]
print(*permutations(N, K))


(n, k) = map(int, input().split())
if k != 0:
	for i in range(n, n - k, -1):
		print(i, end=' ')
	for i in range(1, n - k + 1):
		print(i, end=' ')
else:
	for i in range(1, n + 1):
		print(i, end=' ')


s = input().split()
n = int(s[0])
k = int(s[1])
out = ''
for i in reversed(range(1, k + 2)):
	out += str(i) + ' '
for i in range(k + 2, n + 1):
	out += str(i) + ' '
print(out.strip())


(n, m) = list(map(int, input().split()))
for _ in range(m):
	print(n, end=' ')
	n -= 1
for i in range(1, n + 1):
	print(i, end=' ')


t = input().split()
for i in range(int(t[1])):
	print(int(t[0]) - i, end=' ')
for i in range(int(t[0]) - int(t[1])):
	print(i + 1, end=' ')


def solve():
	(n, k) = map(int, input().split())
	a = []
	i = k + 1
	while i > 0:
		a.append(i)
		i -= 1
	for i in range(len(a) + 1, n + 1):
		a.append(i)
	print(*a)
try:
	solve()
except:
	pass


(n, k) = map(int, input().split())
a = list(range(1, n + 1))
d = a[:k + 1]
i = a[k + 1:]
d.reverse()
l = d + i
print(*l)


(n, k) = [int(x) for x in input().split(' ')]
for i in range(k + 1):
	print(k + 1 - i, end=' ')
for i in range(k + 2, n + 1):
	print(i, end=' ')


(t, n) = list(map(int, input().split()))
li = [i + 1 for i in range(0, t, 1)]
j = n
i = 0
while i < j:
	temp = li[i]
	li[i] = li[j]
	li[j] = temp
	i += 1
	j -= 1
for i in li:
	print(f'{i}', end=' ')
print('\r')


(n, k) = [int(x) for x in input().split()]
print(' '.join([str(y) for y in list(range(1, n - k)) + list(range(n, n - k - 1, -1))]))


def input_ints():
	return list(map(int, input().split()))

def output_list(v):
	print(' '.join((str(x) for x in v)))

def main():
	(n, k) = input_ints()
	ans = []
	for i in range(k + 1):
		ans.append(k + 1 - i)
	for i in range(k + 2, n + 1):
		ans.append(i)
	output_list(ans)
main()


(n, k) = map(int, input().split())
s = [str(i + 1) for i in range(n)]
print(' '.join(s[n - k:][::-1] + s[:n - k]))


(n, k) = map(int, input().split())
arr = [0] * n
ele = n
for i in range(k):
	arr[i] = ele
	ele -= 1
ele = 1
for i in range(k, n):
	arr[i] = ele
	ele += 1
for i in arr:
	print(i, end=' ')
print()


(n, k) = map(int, input().split())
a = [n - i for i in range(n)]
x = a[:k + 1]
y = a[k + 1:]
y = y[::-1] + x
print(' '.join([str(i) for i in y]))


nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
cnt = 0
nums = [i for i in range(1, n + 1)]
temp = nums[0:k + 1][::-1] + nums[k + 1:]
print(' '.join((str(x) for x in temp)))


(n, i) = map(int, input().split())
l = list(range(1, n + 1))
i = -i - 1
l = l[-1:i:-1] + l[0:n + i + 1]
for e in l:
	print(e, end=' ')


(n, k) = map(int, input().split())
s = [int(i) for i in range(n, 0, -1)]
d = s[0:k] + s[k:][::-1]
print(*d)


def permutations(n, k, l):
	m = []
	for i in range(n - 1, n - 1 - k, -1):
		m.append(l[i])
	m.extend(l[:n - k])
	return m
(n, k) = list(map(int, input().split()))
l = []
for i in range(1, n + 1):
	l.append(i)
result = permutations(n, k, l)
for i in result:
	print(i, end=' ')


class CodeforcesTask285ASolution:

	def __init__(self):
		self.result = ''
		self.n_k = []

	def read_input(self):
		self.n_k = [int(x) for x in input().split(' ')]

	def process_task(self):
		inc = [x for x in range(1, self.n_k[0] - self.n_k[1])]
		dc = [x for x in range(self.n_k[0] - self.n_k[1], self.n_k[0] + 1)][::-1]
		self.result = ' '.join([str(x) for x in inc + dc])

	def get_result(self):
		return self.result
Solution = CodeforcesTask285ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, k) = map(int, input().split())
a = [i for i in range(1, n + 1)]
b = a[n - k:]
c = a[:n - k]
a = b[::-1] + c
print(*a)


(n, k) = [int(s) for s in input().split(' ')]
for i in range(1, n - k):
	print(i, end='')
	if i != n:
		print(' ', end='')
for i in range(n, n - k - 1, -1):
	print(i, end='')
	if i != n - k:
		print(' ', end='')
print()


(n, k) = map(int, input().split())
a = []
for i in range(1, n + 1):
	a.append(i)
s = a[:n - k]
t = a[n - k:]
t.sort(reverse=True)
q = t + s
print(*q)


def reverse_with_start_end(A, start, end):
	while start < end:
		A[start] ^= A[end]
		A[end] ^= A[start]
		A[start] ^= A[end]
		start += 1
		end -= 1
	return A
(n, k) = map(int, input().split())
A = [i for i in range(1, n + 1)]
A = reverse_with_start_end(A, 0, n - 1)
A = reverse_with_start_end(A, k, n - 1)
print(*A)


def number_of_inversions(l):
	counter = 0
	for i in range(0, len(l) - 1):
		if l[i] > l[i + 1]:
			counter += 1
	return counter

def is_right_choice(l, k):
	return number_of_inversions(l) == k

def make_k_inversions(n, k):
	length_of_inverted = k + 1
	length_of_non_inverted = n - length_of_inverted
	non_inverted = list(range(1, length_of_non_inverted + 1))
	inverted = list(range(length_of_non_inverted + 1, n + 1))
	inverted.reverse()
	return non_inverted + inverted

def main():
	first_line = input()
	first_line = first_line.split()
	n = int(first_line[0])
	k = int(first_line[1])
	l = make_k_inversions(n, k)
	output = ''
	for item in l:
		output += str(item) + ' '
	print(output)
main()


(n, k) = [int(ch) for ch in input().split(' ')]
input = [i + 1 for i in range(n)]
idx = n - 1 - k
left = input[:n - 1 - k]
right = input[n - 1 - k:]
res = left + sorted(right, reverse=True)
ans = ''
for num in res:
	print(num, end=' ')


(n, k) = list(map(int, input().split()))
v = []
for i in range(k):
	v.append(n - i)
for j in range(n - k):
	v.append(j + 1)
for t in v:
	print(t, end=' ')


(n, k) = map(int, input().split())
t = n
out = []
for i in range(k):
	out.append(n)
	n -= 1
for i in range(t - k):
	out.append(i + 1)
print(*out)


(n, k) = map(int, input().split())
l = []
for i in range(k):
	l.append(n - i)
temp_list = []
for i in range(1, n - k + 1):
	temp_list.append(i)
f_list = l + temp_list
for x in f_list:
	print(x, end=' ')


(n, k) = map(int, input().split())
f = k
arr = []
for i in reversed(range(1, n + 1)):
	if k == 0:
		break
	arr.append(i)
	k -= 1
for i in range(1, n - f + 1):
	arr.append(i)
print(' '.join((str(i) for i in arr)))


(n, k) = map(int, input().split())
A = [0] * n
curr_k = n
curr = 1
for i in range(n):
	if k > 0:
		A[i] = curr_k
		k -= 1
		curr_k -= 1
	else:
		A[i] = curr
		curr += 1
print(*A)


(a, b) = input().split()
a = int(a)
b = int(b)
temp = a - b
ans = []
for i in range(b):
	ans.append(a)
	a -= 1
add = 1
for i in range(temp):
	ans.append(add)
	add += 1
for item in ans:
	print(item, end=' ')


(a, b) = map(int, input().split())
q = []
if b != 0:
	for i in range(1, a - b):
		q.append(i)
	for i in range(a, a - b - 1, -1):
		q.append(i)
	for i in q:
		print(i, end=' ')
else:
	for i in range(1, a + 1):
		print(i, end=' ')


(n, k) = map(int, input().split())
a = [i for i in range(1, k + 2)]
b = [i for i in range(k + 2, n + 1)]
l = a[::-1] + b
print(*l)


(n, k) = [int(x) for x in input().split()]
for i in range(n, n - k, -1):
	print(str(i), end=' ')
for i in range(1, n - k + 1):
	if i == n - k:
		print(str(i), end='')
	else:
		print(str(i), end=' ')
print()


(n, k) = map(int, input().split())
print(*list(reversed(range(1, k + 2))) + list(range(k + 2, n + 1)))


(n, k) = map(int, input().split(' '))
ans = [x for x in range(n, n - k, -1)] + [x for x in range(1, n - k + 1)]
print(*ans)


(n, k) = list(map(int, input().split()))
z = [i for i in range(1, n + 1)]
x = z[:n - k - 1]
y = z[n - k - 1:]
ans = x + y[::-1]
print(*ans)


import collections
import math
from sys import stdin

def get(t=int):
	lis = stdin.readline().strip().split()
	return list(map(t, lis))

def single_str():
	return get(str)[0]
(n, k) = get()
a = [i for i in range(1, n + 1)]
print(*list(reversed(a[:k + 1])) + a[k + 1:])


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def main():
	(n, k) = vars()
	arr = []
	num = n
	i = 0
	l = num + 1
	while i < k:
		arr.append(num)
		l = num
		num -= 1
		i += 1
	for i in range(1, l):
		arr.append(i)
	print(*arr)
t = 1
for _ in range(t):
	main()


(n, k) = map(int, input().split())
a = [0] * n
for i in range(0, n):
	a[i] = i + 1
if k % 2 == 0:
	b = k // 2
else:
	b = k // 2 + 1
for i in range(0, b):
	temp = a[i]
	a[i] = a[k - i]
	a[k - i] = temp
for i in range(0, n):
	print(a[i], end=' ')
print()


import sys
from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt, gcd

def ip():
	return int(sys.stdin.readline())

def sip():
	return sys.stdin.readline()

def mip():
	return map(int, sys.stdin.readline().split())

def mips():
	return map(str, sys.stdin.readline().split())

def lip():
	return list(map(int, sys.stdin.readline().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
(n, k) = mip()
for i in range(n, n - k, -1):
	print(i, end=' ')
for i in range(1, n - k + 1):
	print(i, end=' ')
print()


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect, insort
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
(n, x) = L()
A = [i for i in range(1, n + 1)]
if x:
	print(*A[-x:][::-1] + A[:-x])
else:
	print(*A)
endtime = time.time()


(n, k) = list(map(int, input().split()))
k += 1
l = [i for i in range(1, n + 1)]
p = l[:k]
p.sort(reverse=True)
l = p + l[k:]
l = map(str, l)
print(' '.join(l))


(n, k) = map(int, input().split())
a = [x for x in range(1, n + 1)]
ans = []
for i in range(k, -1, -1):
	ans.append(a[i])
for i in range(k + 1, n):
	ans.append(a[i])
print(*ans)


def main():
	(n, k) = [int(i) for i in input().split()]
	vez = 1
	ate = n
	cont = 0
	while vez <= ate:
		if cont < k:
			print(ate, end=' ')
			ate -= 1
			cont += 1
		else:
			print(vez, end=' ')
			vez += 1
	print()
main()


import os
import sys
import random
(n, k) = map(int, input().split())
if n - k == 1:
	c = n
	print(c)
	for i in range(1, n):
		c = c - 1
		print(c)
	quit()
c = 1
print(c)
for i in range(1, n):
	if i > n - k - 1:
		c = c - 1
		print(c)
	elif i == n - k - 1:
		c = n
		print(c)
	else:
		c = c + 1
		print(c)


(n, k) = map(int, input().split(' '))
nums = []
for i in range(0, k):
	nums.append(n - i)
for i in range(1, n - k + 1):
	nums.append(i)
print(' '.join(map(str, nums)))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def msi():
	return map(str, input().split())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
mod = 1000000007

def modInverse(b, m):
	g = gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def modu(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	if inv == -1:
		return -999999999
	else:
		return inv * a % m
from math import log, factorial, cos, tan, sin, radians, floor, log2
import bisect
from decimal import *
getcontext().prec = 8
abc = 'abcdefghijklmnopqrstuvwxyz'
pi = 3.141592653589793

def gcd1(a):
	if len(a) == 1:
		return a[0]
	ans = a[0]
	for i in range(1, len(a)):
		ans = gcd(ans, a[i])
	return ans

def main():
	for _ in range(1):
		(n, k) = mi()
		l = []
		for i in range(k + 1, 0, -1):
			l.append(i)
		if n >= k + 2:
			for i in range(k + 2, n + 1):
				l.append(i)
		print(*l)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, k) = map(int, input().split())
ans = []
if k == 0:
	for i in range(1, n + 1):
		ans.append(i)
	print(*ans, sep=' ')
else:
	new = 0
	for i in range(k):
		ans.append(n - i)
		new = n - i
	for i in range(1, new):
		ans.append(i)
	print(*ans, sep=' ')


(n, k) = map(int, input().split())
s = ''
i = 0
c = 0
for i in range(0, n - k - 1):
	s += str(i + 1) + ' '
	c = 1
ss = []
for j in range(i + 1, i + k + 2):
	if c == 1:
		ss += [str(j + 1)]
	else:
		ss += [str(j)]
ss = ss[::-1]
sss = ''
for i in range(0, len(ss)):
	sss += ss[i] + ' '
print(s + sss)


def inp():
	return map(int, input().split())
(n, k) = inp()
for i in range(n - k - 1):
	print(i + 1, end=' ')
for i in range(n, n - k - 1, -1):
	print(i, end=' ')


input1 = input().split()
input1 = list(map(int, input1))
n = input1[0]
k = input1[1]
l1 = [i for i in range(n, 0, -1)]
x = l1[k:]
x = x[::-1]
s = l1[:k] + x
s = list(map(str, s))
s = ' '.join(s)
print(s)


(n, k) = map(int, input().split())
i = n
m = k
while m > 0:
	print(i, end=' ')
	i -= 1
	m -= 1
temp = n - k
i = 1
while temp > 0:
	print(i, end=' ')
	i += 1
	temp -= 1
print()


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
(n, k) = M()
for i in range(n, n - k, -1):
	print(i, end=' ')
for i in range(1, n - k + 1):
	print(i, end=' ')


import sys, threading, os.path
import collections, heapq, math, bisect
import string
from platform import python_version
import itertools
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)

def main():
	if os.path.exists('input.txt'):
		input = open('input.txt', 'r')
	else:
		input = sys.stdin
	(a, k) = list(map(int, input.readline().split()))
	sol = []
	for i in list(range(k + 1, 0, -1)) + list(range(k + 2, a + 1)):
		sol.append(i)
	output = ' '.join(map(str, sol))
	if os.path.exists('output.txt'):
		open('output.txt', 'w').writelines(str(output))
	else:
		sys.stdout.write(str(output))
main()


(n, k) = map(int, input().split())
li = [i for i in range(1, n + 1)]
res = []
i = n - 1
while k:
	res.append(li[i])
	i -= 1
	k -= 1
res.extend(li[:i + 1])
print(*res)


b = list(map(int, input().split()))
a = []
for i in range(1, b[0] + 1):
	a.append(i)
c = a[:b[1] + 1]
c.reverse()
a = c + a[b[1] + 1:]
for j in a:
	print(j, end=' ')


def main() -> int:
	(n, k) = map(int, input().split())
	head = [i for i in range(k + 1, 0, -1)]
	tail = [i for i in range(k + 2, n + 1, 1)]
	print(' '.join((str(i) for i in head + tail)))
	return 0

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
R = []
for i in range(1, n - k):
	R.append(i)
for i in range(n, n - k - 1, -1):
	R.append(i)
print(' '.join(map(str, R)))


X = list(map(int, input().split()))
Answer = []
for i in range(X[0], X[0] - X[1], -1):
	Answer.append(i)
for i in range(1, X[0] - X[1] + 1):
	Answer.append(i)
print(*Answer)


(n, k) = map(int, input().split())
line = list(range(n, n - k, -1)) + list(range(1, n - k + 1))
print(' '.join(map(str, line)))


(n, k) = input().split()
n = int(n)
k = int(k)
nn = n
arr = []
for i in range(k):
	arr.append(n)
	n -= 1
for i in range(nn - k):
	arr.append(i + 1)
for i in range(nn):
	print(arr[i], end=' ')


(n, m) = map(int, input().split())
l = [i for i in range(1, n + 1)]
l1 = []
while m > 0:
	l1.append(l[n - 1])
	del l[n - 1]
	n = n - 1
	m = m - 1
print(*l1 + l)


(n, k) = list(map(int, input().split()))
i = 1
while i < n - k:
	print(i, end='')
	print(' ', end='')
	i += 1
i = n
while i > n - k - 1:
	print(i, end='')
	print(' ', end='')
	i -= 1


(n, k) = map(int, input().split())
p = [str(x) for x in range(1, n + 1)]
p = p[k:0:-1] + ['1'] + p[k + 1:]
print(' '.join(p))


from collections import Counter
(n, m) = map(int, input().split())
a = list(range(1, n + 1))
a.sort()
b = a[n - 1:n - m - 1:-1] + a[0:n - m]
for i in b:
	print(i, end=' ')


import math

def main():
	(n, k) = map(int, input().split())
	res = []
	if k == 0:
		res = [x for x in range(1, n + 1)]
	else:
		res = [x for x in range(n, n - k, -1)] + [x for x in range(1, n - k + 1)]
	print(' '.join(map(str, res)))
main()


(n, k) = map(int, input().strip().split())
answer = list(range(n, n - k, -1)) + list(range(1, n - k + 1))
print(*answer)


nk = input().split()
j = int(nk[0])
for i in range(int(nk[1])):
	print(j, end=' ')
	j -= 1
for i in range(1, j + 1):
	print(i, end=' ')


def dec_premutations(k, n):
	arr = list(range(1, n + 1))
	temp = []
	for i in range(k):
		temp.append(arr[-(i + 1)])
	temp.extend(arr[:len(arr) - k])
	print(*temp)
(n, k) = map(int, input().split())
dec_premutations(k, n)


(n, k) = map(int, input().split())
lstrs = []
pos = k + 1
while pos > 0:
	lstrs.append(str(pos))
	pos -= 1
for i in range(k + 2, n + 1):
	lstrs.append(str(i))
print(' '.join(lstrs))


(n, k) = map(int, input().split())
line = [str(it + 1) for it in range(n)]
line = [str(it) for it in range(n, n - k, -1)] + [str(it) for it in range(1, n - k + 1)]
print(' '.join(line))


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
(n, k) = R()
for i in range(1, n - k):
	print(i, end=' ')
for i in range(n, n - k - 1, -1):
	print(i, end=' ')


(n, k) = map(int, input().split())
z = [x for x in range(n, 0, -1)]
print(*z[k + 1:][::-1] + z[:k + 1])


(n, k) = map(int, input().split())
ans = []
for i in range(k + 1):
	ans.append(k - i + 1)
for i in range(k + 2, n + 1):
	ans.append(i)
print(' '.join((str(ans[i]) for i in range(n))))


import math
import sys

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
(n, k) = mi()
j = n
t = [n - i for i in range(k)] + [i for i in range(1, n - k + 1)]
print(' '.join(map(str, t)), end=' ')


from collections import Counter
c = 0
(n, m) = map(int, input().split())
for i in range(1, n + 1):
	if i < m + 1:
		print(n + 1 - i, end=' ')
	else:
		print(i - m, end=' ')


(n, k) = [int(j) for j in input().split()]
num = n
for j in range(k):
	print(num, end=' ')
	num -= 1
for j in range(1, n - k + 1):
	print(j, end=' ')


a = list(input().split())
n = int(a[0])
k = int(a[1])
b = list(range(1, n + 1, 1))
if k != n:
	for j in range(k, -1, -1):
		print(b[j], end=' ')
	if k != n - 1:
		for j in range(k + 1, n, 1):
			print(b[j], end=' ')
else:
	for j in range(n - 1, -1, -1):
		print(b[j], end=' ')


arr = [int(x) for x in input().split()]
(n, k) = (arr[0], arr[1])
c = n - k - 1
ans = [i + 1 for i in range(c)]
for i in range(n, n - k - 1, -1):
	ans.append(i)
print(*ans)


(n, m) = map(int, input().split(' '))
idx = n
for i in range(m):
	print(idx, end=' ')
	idx -= 1
idx = 1
for i in range(m + 1, n + 1):
	print(idx, end=' ')
	idx += 1


from math import sqrt, ceil, floor
import sys
from collections import Counter, deque
from collections import defaultdict as dd

def foo(x):
	for i in range(len(x)):
		if x[i] not in ['4', '7']:
			return 'NO'
	return 'YES'
(n, k) = map(int, input().split())
k += 1
arr = list(range(1, n - k + 1))
for i in range(n, n - k, -1):
	arr.append(i)
print(*arr)


(n, k) = map(int, input().split())
arr = [i for i in range(1, n + 1)]
arr.sort(reverse=True)
if k == n - 1:
	arr.sort(reverse=True)
	print(*arr)
else:
	new_arr = arr[:k] + sorted(arr[k:])
	print(*new_arr)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

def in_list():
	return list(map(int, input().split()))

def in_str():
	s = input()
	return list(s[:len(s) - 1])

def in_ints():
	return map(int, input().split())
mod = 7 + 10 ** 9
(n, k) = in_ints()
a = [i for i in range(1, n + 1)]
a = a[:n - k - 1] + a[n - k - 1:][::-1]
for xx in a:
	print(xx, end=' ')


(n, k) = map(int, input().split())
l = []
j = 1
l = [i for i in range(1, k + 2)]
l.sort(reverse=True)
m = k + 2
for j in range(n - len(l)):
	l.append(m)
	m = m + 1
print(*l)


(n, k) = map(int, input().split())
res = []
i = 0
m = n
while i < k:
	res.append(m)
	m -= 1
	i += 1
i = 0
m = 1
while i < n - k:
	res.append(m)
	m += 1
	i += 1
print(' '.join((str(i) for i in res)))


import sys
import math
import bisect

def solve(n, m):
	A = [0] * n
	for i in range(n):
		A[i] = i + 1
	B = []
	for i in range(m):
		B.append(A[-1])
		A.pop()
	return B + A

def main():
	(n, m) = map(int, input().split())
	A = solve(n, m)
	print(' '.join(list((str(a) for a in A))))
main()


(n, k) = map(int, input().strip().split())
r = [a for a in range(n, 0, -1)]
b = [k for k in r[:n - k]]
b.sort()
r = b + r[n - k:]
print(*r)


(n, k) = map(int, input().split())
a = [*range(1, n + 1)]
print(*a[:n - k - 1], *a[-1:-2 - k:-1])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def main():
	(n, k) = LI()
	t = n - k
	r = list(range(1, t)) + list(range(n, t - 1, -1))
	return JA(r, ' ')
print(main())


(n, k) = [int(x) for x in input().split(' ')]
ans = [str(x) for x in range(1, n + 1)]
k += 1
temp = ans[:n - k]
temp += ans[n - k:][::-1]
print(' '.join(temp))


from sys import stdin, stdout
(a, b) = map(int, stdin.readline().split())
lst = [i + 1 for i in range(a)]
lst.reverse()
lst1 = lst[:b]
lst2 = lst[b:]
lst2.reverse()
new = lst1 + lst2
for i in new:
	stdout.write(str(i) + ' ')


from sys import stdin, stdout, stderr, setrecursionlimit
setrecursionlimit(100000)

def debug(*e):
	if not __debug__:
		print(*e, file=stderr)

def dd(*vals):
	import inspect, re
	frame = inspect.getframeinfo(inspect.stack()[1][0])
	vs = re.search('dd\\((.+)\\)', frame.code_context[0]).group(1).split(',')
	if vs:
		debug(','.join(('{0} = {1}'.format(vs[i], v) for (i, v) in enumerate(vals))))

def trace(f):

	def traced(*args, **kw):
		debug('calling {} with args {}, {}'.format(f.__name__, args, kw))
		return f(*args, **kw)
	return traced

def read():
	return stdin.readline().rstrip()

def readarr(sep=None, maxsplit=-1):
	return read().split(sep, maxsplit)

def readint():
	return int(read())

def readintarr(sep=None, maxsplit=-1):
	return [int(a) for a in readarr(sep, maxsplit)]

def write(*args, **kwargs):
	sep = kwargs.get('sep', ' ')
	end = kwargs.get('end', '\n')
	stdout.write(sep.join((str(a) for a in args)) + end)

def writearr(arr, sep=' ', end='\n'):
	stdout.write(sep.join((str(a) for a in arr)) + end)
(n, k) = readintarr()
if k == 0:
	write(' '.join(map(str, range(1, n + 1))))
	exit()
x = list(range(1, n - k)) + list(range(n, n - k - 1, -1))
write(' '.join((str(i) for i in x)))


[n, k] = [int(i) for i in input().split()]
a = [i for i in range(n, n - k, -1)]
b = [i for i in range(1, n - k + 1, 1)]
print(' '.join([str(i) for i in a] + [str(i) for i in b]))


(n, k) = map(int, input().split())
a = [i for i in range(1, n + 1)]
a = list(reversed(a[:k + 1])) + a[k + 1:]
for x in a:
	print(x, end=' ')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n, k) = I()
for i in range(k + 1, 0, -1):
	print(i, end=' ')
for i in range(k + 2, n + 1):
	print(i, end=' ')


(n, k) = map(int, input().split())
a = []
for i in range(1, n + 1):
	a.append(i)
a = []
for i in range(n - k - 1):
	a.append(i + 1)
b = []
for i in range(k + 1):
	b.append(n - i)
a += b
for i in a:
	print(i, end=' ')


import string
alphabet = list(string.ascii_lowercase)
inf = 2 ** 20

def print_sequence(s):
	print(*s, sep=' ')

def read_sequence():
	return list(map(int, input().split()))

def print_bool_result(res):
	if res:
		print('Yes')
	else:
		print('No')
(n, k) = read_sequence()
result = [i + 1 for i in range(n - k - 1)] + [n - i for i in range(k + 1)]
print_sequence(result)


(n, k) = [int(x) for x in input().split()]

def g():
	yield from range(k + 1, 0, -1)
	yield from range(k + 2, n + 1)
print(' '.join(map(str, g())))


(n, k) = map(int, input().split(' '))
l = [i for i in range(k + 1, 0, -1)]
j = [k for k in range(k + 2, n + 1)]
print(' '.join(map(str, l + j)))


(n, k) = map(int, input().split())
if k == 0:
	x = 1
	for _ in range(0, n):
		print(x, end=' ')
		x = x + 1
elif k == n - 1:
	x = n
	while x > 0:
		print(x, end=' ')
		x = x - 1
else:
	rem = n - k - 1
	start = 1
	for _ in range(0, rem):
		print(start, end=' ')
		start = start + 1
	while k >= 0:
		print(n, end=' ')
		n = n - 1
		k = k - 1
print('')


(perm_length, factor) = list(map(lambda x: int(x), input().split(' ')))
a = ' '.join(map(lambda x: str(x), list(reversed(range(perm_length - factor + 1, perm_length + 1)))))
b = ' '.join(map(lambda x: str(x), list(range(1, perm_length - factor + 1))))
print(a + ' ' + b)