#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
int n, m, i, j, fa[100005];
bool checkfull(int x) {
  x++;
  if (x == (x & -x)) return 1;
  return 0;
}
int main() {
  read(n);
  read(m);
  if (n == 9 && m == 2) {
    puts("NO");
    return 0;
  }
  if (!(n & 1)) {
    puts("NO");
    return 0;
  }
  int lim = max(0, (n - 3) / 2);
  if (m > lim) {
    puts("NO");
    return 0;
  }
  if (checkfull(n) && m == 1) {
    puts("NO");
    return 0;
  }
  if (!checkfull(n) && m == 0) {
    puts("NO");
    return 0;
  }
  puts("YES");
  for (((i)) = (1); ((i)) <= ((m - 1)); ((i))++) {
    fa[i * 2 - 1] = max(0, i * 2 - 3);
    fa[i * 2] = i * 2 - 1;
  }
  int bse = max(0, m - 1) * 2;
  for (((i)) = (1); ((i)) <= ((n - bse)); ((i))++) {
    if (i == 1) {
      fa[i + bse] = max(0, bse - 1);
    } else {
      fa[i + bse] = i / 2 + bse;
    }
  }
  if (checkfull(n - bse) && m) {
    fa[n - 1] = fa[n] = 2;
  }
  for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
    printf("%d ", fa[i]);
  }
  return 0;
}
