#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
bool isbalanced(int x, int y) { return (2 * x > y && 2 * y > x); }
bool ispow(int x) { return (__builtin_popcount(x + 1) == 1); }
int getdep(int x) { return __builtin_ctz(x + 1); }
int n, k, cnt;
int ans[MAXN];
void build(int fa, int dep) {
  if (dep == 0) return;
  ans[++cnt] = fa;
  build(cnt, dep - 1);
  ans[++cnt] = fa;
  build(cnt, dep - 1);
}
void fail() {
  puts("NO");
  exit(0);
}
bool check(int n, int k) {
  if ((n + 1) & 1) return false;
  if (n == 1 || n == 3) return k == 0;
  if (n == 5) return k == 1;
  if (n == 7) return k == 0 || k == 2;
  if (n == 9) return k == 1 || k == 3;
  if (k == 0) return ispow(n);
  if (k == 1) {
    for (int l = 1; l <= n; l = l * 2 + 1) {
      if (!isbalanced(l, n - l - 1) && check(n - l - 1, k - 1)) return true;
      if (isbalanced(l, n - l - 1) && check(n - l - 1, k)) return true;
    }
    return false;
  }
  return k <= max(0, (n - 3) / 2);
}
void dfs(int n, int k, int rt) {
  if (!n) return;
  if (k == 0) {
    if (!ispow(n)) fail();
    build(rt, getdep(n) - 1);
  } else if (k == 1) {
    for (int y = (1 << (31 - __builtin_clz(n))); y >= 2; y /= 2) {
      if (isbalanced(n - y, y - 1) && check(n - y, k)) {
        ans[++cnt] = rt;
        build(cnt, getdep(y - 1) - 1);
        ans[++cnt] = rt;
        rt = cnt;
        dfs(n - y, k, rt);
        return;
      } else if (ispow(n - y) && ispow(y - 1) && !isbalanced(n - y, y - 1)) {
        ans[++cnt] = rt;
        build(cnt, getdep(n - y) - 1);
        ans[++cnt] = rt;
        build(cnt, getdep(y - 1) - 1);
        return;
      }
    }
    fail();
  } else {
    bool ok = 0;
    for (int l = 1; l <= n; l = l * 2 + 1) {
      assert(ispow(l));
      if (!isbalanced(l, n - l - 1) && check(n - l - 1, k - 1)) {
        ans[++cnt] = rt;
        dfs(l, 0, cnt);
        ans[++cnt] = rt;
        dfs(n - l - 1, k - 1, cnt);
        ok = 1;
        break;
      }
    }
    if (!ok) {
      printf("n = %d k = %d\n", n, k);
    }
    assert(ok);
  }
}
int main() {
  scanf("%d %d", &n, &k);
  if (!check(n, k)) fail();
  ans[++cnt] = 0;
  dfs(n, k, 1);
  puts("YES");
  for (int i = 1; i <= cnt; i++) printf("%d%c", ans[i], " \n"[i == n]);
  return 0;
}
