#include <bits/stdc++.h>
using namespace std;
bool sortinrev(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  if (a.first == b.first) {
    return (a.second > b.second);
  }
  return (a.first > b.first);
}
long long negmod(long long a, long long b) { return (a % b + b) % b; }
void LPS(string pattern, long long m, long long lps[]) {
  long long len = 0;
  lps[0] = 0;
  long long i = 1;
  while (i < m) {
    if (pattern[i] == pattern[len]) {
      len++;
      lps[i] = len;
      i++;
    } else {
      if (len != 0) {
        len = lps[len - 1];
      } else {
        lps[i] = 0;
        i++;
      }
    }
  }
}
int kmp(string pattern, string text) {
  long long m = pattern.size();
  long long n = text.size();
  long long lps[m];
  LPS(pattern, m, lps);
  long long i = 0;
  long long j = 0;
  while (i < n) {
    if (pattern[j] == text[i]) {
      j++;
      i++;
    }
    if (j == m) {
      j = lps[j - 1];
      return 1;
    } else if (i < n && pattern[j] != text[i]) {
      if (j != 0)
        j = lps[j - 1];
      else
        i = i + 1;
    }
  }
  return 0;
}
int check(string s, int len) {
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] != s[i % len]) return false;
  }
  return true;
}
long long countdistinct(string s) {
  int arr[200] = {0};
  long long ans = 0;
  for (long long i = 0; i < s.size(); i++) {
    arr[s[i] - ' ']++;
  }
  for (long long i = 0; i < 200; i++) {
    if (arr[i] >= 1) ans++;
  }
  return ans;
}
long long fastpow(long long base, long long exp) {
  if (exp == 0) return 1;
  if (exp == 1) return base % 1;
  long long t = fastpow(base, exp / 2);
  t = (t * t) % 1;
  if (exp % 2 == 0)
    return t;
  else
    return ((base % 1) * t) % 1;
}
bool isprime(long long num) {
  bool flag = true;
  for (long long i = 2; i * i <= num; i++) {
    if (num % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
int main() {
  long long t = 1, n, m = 0, k = 0, h, p, q, r, count1 = 0, maxx = LLONG_MIN,
            sum = 0, a = 0, b = 0, c, d, reqs, minn = LLONG_MAX,
            minn1 = LLONG_MAX, x, y, time = 0;
  vector<long long>::iterator ip;
  map<string, long long> mh;
  while (t--) {
    sum = 0, count1 = 0;
    minn = minn1 = LLONG_MAX;
    maxx = LLONG_MIN;
    vector<long long> v, v1, v2, v3, v4, v5, v6;
    vector<pair<char, long long> > v7;
    string str, str1, str2;
    set<long long> s, s1;
    vector<string> v8, v9;
    long long curr = 0, curr1 = 0, prev = 0;
    cin >> n >> k;
    for (long long i = 1; i <= n; i++) {
      v.push_back(i);
    }
    if (k == n - 1) {
      for (long long i = n - 1; i >= 0; i--) cout << v[i] << " ";
      cout << endl;
      continue;
    }
    if (k == 0) {
      for (long long i = 0; i < n; i++) cout << v[i] << " ";
      cout << endl;
      continue;
    }
    for (long long j = n - 1; j >= n - k; j--) {
      cout << v[j] << " ";
    }
    for (long long i = 0; i < n - k; i++) {
      cout << v[i] << " ";
    }
    cout << endl;
  }
}
