#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void cmin(T &a, T b) {
  ((a > b) && (a = b));
}
template <class T>
inline void cmax(T &a, T b) {
  ((a < b) && (a = b));
}
char IO;
template <class T = int>
T rd() {
  T s = 0;
  int f = 0;
  while (!isdigit(IO = getchar())) f |= IO == '-';
  do s = (s << 1) + (s << 3) + (IO ^ '0');
  while (isdigit(IO = getchar()));
  return f ? -s : s;
}
const int N = 1e5 + 10;
int n, m;
int fa[N];
int chk(int a, int b) {
  if (a > b) swap(a, b);
  return a * 2 <= b;
}
void Out() {
  puts("YES");
  static int ind[N];
  for (int i = 1, iend = n; i <= iend; ++i) ind[fa[i]]++;
  for (int i = 1, iend = n; i <= iend; ++i)
    if (ind[i] != 0 && ind[i] != 2) {
      cout << "SOMETHING WENT WRONG? " << i << ' ' << ind[i] << endl;
      exit(0);
    }
  for (int i = 1, iend = n; i <= iend; ++i) printf("%d ", fa[i]);
  exit(0);
}
int Get(int l, int r) {
  for (int i = l + 1, iend = r; i <= iend; ++i) fa[i] = l - 1 + (i - l + 1) / 2;
  return l;
}
int Mincost(int x) {
  if (~x & 1) return 1e9;
  for (int i = 0, iend = 17; i <= iend; ++i)
    if (x + 1 == (1 << i)) return 0;
  return 1;
}
int main() {
  n = rd(), m = rd();
  if (m == 0) {
    if (Mincost(n) == 0) Get(1, n), Out();
    puts("NO"), exit(0);
  }
  if (~n & 1) puts("NO"), exit(0);
  if ((m + 1) * 2 >= n) puts("NO"), exit(0);
  int r = (m + 1) * 2 + 1;
  if (r == n) {
    for (int i = 1, iend = m + 1; i <= iend; ++i)
      fa[i * 2] = i * 2 - 1, fa[i * 2 + 1] = i * 2 - 1;
    Out();
  }
  r -= 2;
  int c = n - r + 2;
  for (int x = 1, xend = c - 1; x <= xend; ++x)
    if (Mincost(x) + Mincost(c - x) + (min(x, c - x) * 2 <= max(x, c - x)) ==
        1) {
      for (int i = 1, iend = m - 1; i <= iend; ++i)
        fa[i * 2] = i * 2 - 1, fa[i * 2 + 1] = i * 2 - 1;
      int t = max(0, r - 2);
      fa[Get(r - 1, r + x - 2)] = t;
      fa[Get(r + x - 1, n)] = t;
      Out();
    }
  if (m > 1)
    for (int x = 1, xend = c - 1; x <= xend; ++x)
      if (Mincost(x) + Mincost(c - x) - !chk(c - x, n - 1 - (c - x)) +
              (x >= 3) ==
          1) {
        for (int i = 1, iend = m; i <= iend; ++i)
          fa[i * 2] = i * 2 - 1, fa[i * 2 + 1] = i * 2 - 1;
        int t = max(0, r - 2);
        fa[Get(r - 1, r + x - 2)] = t;
        fa[2] = t;
        fa[Get(r + x - 1, n)] = 1;
        Out();
      }
  r -= 2;
  c = n - r + 2;
  if (r < 3) puts("NO"), exit(0);
  for (int x = 1, xend = c - 1; x <= xend; ++x)
    if (Mincost(x) + Mincost(c - x) + (min(x, c - x) * 2 <= max(x, c - x)) ==
        2) {
      for (int i = 1, iend = m - 2; i <= iend; ++i)
        fa[i * 2] = i * 2 - 1, fa[i * 2 + 1] = i * 2 - 1;
      int t = max(0, r - 2);
      fa[Get(r - 1, r + x - 2)] = t;
      fa[Get(r + x - 1, n)] = t;
      Out();
    }
  r -= 2;
  c = n - r + 2;
  if (r < 3) puts("NO"), exit(0);
  for (int x = 1, xend = c - 1; x <= xend; ++x)
    if (Mincost(x) + Mincost(c - x) + (min(x, c - x) * 2 <= max(x, c - x)) ==
        3) {
      for (int i = 1, iend = m - 3; i <= iend; ++i)
        fa[i * 2] = i * 2 - 1, fa[i * 2 + 1] = i * 2 - 1;
      int t = max(0, r - 2);
      fa[Get(r - 1, r + x - 2)] = t;
      fa[Get(r + x - 1, n)] = t;
      Out();
    }
  puts("NO"), exit(0);
}
