#include <bits/stdc++.h>
using namespace std;
int n, k;
int s[100005], si[100005];
int main() {
  scanf("%d%d", &n, &k);
  if (n % 2 == 0) {
    puts("NO");
    return 0;
  }
  if (n == 1 && k == 0) {
    puts("YES");
    puts("0");
    return 0;
  }
  int tmp = (n - 3) / 2;
  if (tmp < k) {
    puts("NO");
    return 0;
  }
  if (n == 7 && k == 1) {
    puts("NO");
    return 0;
  }
  if (n == 9 && k == 2) {
    puts("NO");
    return 0;
  }
  if (k == 0) {
    int len = 1;
    while (len <= n) len = len * 2;
    if (len != n + 1) {
      puts("NO");
      return 0;
    }
    for (int i = 1; i <= n; i++) s[i] = i / 2;
    puts("YES");
    for (int i = 1; i < n; i++) printf("%d ", s[i]);
    printf("%d\n", s[n]);
    return 0;
  }
  if (k == 1) {
    int len = 1;
    while (len <= n) len = len * 2;
    if (len == n + 1) {
      puts("NO");
      return 0;
    }
  }
  int ti = n - 2 * k + 2, len = 1;
  while (len < ti) len = len * 2;
  if (len != ti + 1) {
    for (int i = 1; i <= ti; i++) s[i] = i / 2;
    int la = 1, tot = ti;
    for (int i = 1; i <= k - 1; i++) {
      tot += 2;
      s[tot - 1] = tot;
      s[la] = tot;
      la = tot;
    }
  } else {
    ti -= 2;
    for (int i = 1; i <= ti; i++) s[i] = i / 2;
    int la = 1, tot = ti;
    for (int i = 1; i <= k; i++) {
      tot += 2;
      s[tot - 1] = tot;
      s[la] = tot;
      la = tot;
    }
    s[tot - 2] = 0;
    s[tot - 1] = s[tot] = tot - 3;
  }
  puts("YES");
  for (int i = 1; i < n; i++) printf("%d ", s[i]);
  printf("%d\n", s[n]);
  return 0;
}
