#include <bits/stdc++.h>
using namespace std;
std::mt19937 rnd(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
int n, wantimbal;
int par[MAXN];
int nxtnode;
int calcmn(int n) {
  ++n;
  while (n % 2 == 0) n /= 2;
  return n == 1 ? 0 : 1;
}
int calcmx(int n) {
  if (n == 1) return 0;
  return (n - 3) / 2;
}
bool forbidden(int n, int imbal) {
  if (calcmn(n) == 0 && imbal == 1) return true;
  if (n == 7 && imbal == 1 || n == 9 && imbal == 2) return true;
  return false;
}
void rec(int target, int cnt, int at) {
  assert(cnt >= 1 && cnt % 2 == 1);
  if (cnt == 1) {
    assert(target == 0);
    return;
  }
  for (int l = 1; l < cnt; l += 2) {
    int r = cnt - l - 1;
    assert(r >= 1 && r % 2 == 1);
    int extra = max(l, r) >= 2 * min(l, r) ? 1 : 0;
    if (extra > target) continue;
    int lmn = calcmn(l), lmx = calcmx(l), rmn = calcmn(r), rmx = calcmx(r);
    if (extra + lmn + rmn > target) continue;
    if (extra + lmx + rmx < target) continue;
    int ltarget = min(target - extra - rmn, lmx);
    int rtarget = target - extra - ltarget;
    if (l == 7 && ltarget == 1) {
      if (rtarget < rmx)
        --ltarget, ++rtarget;
      else if (rtarget > rmn)
        ++ltarget, --rtarget;
      else
        continue;
    }
    if (r == 7 && rtarget == 1) {
      if (ltarget < lmx)
        --rtarget, ++ltarget;
      else if (ltarget > lmn)
        ++rtarget, --ltarget;
      else
        continue;
    }
    if (l == 7 && ltarget == 1 || r == 7 && rtarget == 1) continue;
    if (forbidden(l, ltarget) || forbidden(r, rtarget)) continue;
    assert(ltarget >= lmn && ltarget <= lmx && rtarget >= rmn &&
           rtarget <= rmx && target == ltarget + rtarget + extra);
    int lnode = nxtnode++;
    int rnode = nxtnode++;
    par[lnode] = at;
    par[rnode] = at;
    rec(ltarget, l, lnode);
    rec(rtarget, r, rnode);
    return;
  }
  assert(false);
}
bool solve() {
  if (n % 2 == 0) return false;
  par[0] = -1, nxtnode = 1;
  if (wantimbal < calcmn(n) || wantimbal > calcmx(n) || forbidden(n, wantimbal))
    return false;
  rec(wantimbal, n, 0);
  return true;
}
void run() {
  scanf("%d%d", &n, &wantimbal);
  if (!solve()) {
    printf("NO\n");
    return;
  }
  printf("YES\n");
  for (int i = (0); i < (n); ++i) {
    if (i != 0) printf(" ");
    printf("%d", par[i] + 1);
  }
  puts("");
}
void research() {
  int n = 101;
  vector<int> mn(n + 1, INT_MAX);
  vector<pair<int, int>> howmn(n + 1, pair<int, int>(-1, -1));
  vector<int> mx(n + 1, INT_MIN);
  vector<pair<int, int>> howmx(n + 1, pair<int, int>(-1, -1));
  mn[1] = mx[1] = 0;
  for (int i = 3; i <= n; i += 2) {
    for (int l = 1; l < i; l += 2) {
      int r = i - l - 1;
      assert(r >= 1 && r % 2 == 1);
      int extra = max(l, r) >= 2 * min(l, r) ? 1 : 0;
      int curmn = mn[l] + mn[r] + extra;
      if (curmn < mn[i]) mn[i] = curmn, howmn[i] = make_pair(l, r);
      int curmx = mx[l] + mx[r] + extra;
      if (curmx > mx[i]) mx[i] = curmx, howmx[i] = make_pair(l, r);
    }
  }
  for (int i = (0); i <= (n); ++i)
    if (i % 2 == 1) assert(mn[i] == calcmn(i) && mx[i] == calcmx(i));
  for (int i = (0); i <= (n); ++i)
    if (i % 2 == 1)
      printf("%d: %d..%d [%d/%d] [%d/%d]\n", i, mn[i], mx[i], howmn[i].first,
             howmn[i].second, howmx[i].first, howmx[i].second);
}
void verify() {
  vector<int> sz(n, 1);
  vector<vector<int>> chsz(n);
  assert(par[0] == -1);
  for (int i = n - 1; i >= 1; --i) {
    assert(par[i] < i);
    sz[par[i]] += sz[i];
    chsz[par[i]].push_back(sz[i]);
  }
  for (int i = (0); i < (n); ++i)
    assert(((int)(chsz[i]).size()) == 0 || ((int)(chsz[i]).size()) == 2);
  int have = 0;
  for (int i = (0); i < (n); ++i)
    if (((int)(chsz[i]).size()) == 2) {
      int a = chsz[i][0], b = chsz[i][1];
      if (max(a, b) >= 2 * min(a, b)) ++have;
    }
  assert(have == wantimbal);
}
void stress() {
  for (n = 1; n <= 1001; n += 2) {
    int mn = calcmn(n), mx = calcmx(n);
    for (wantimbal = mn; wantimbal <= mx; ++wantimbal) {
      if (forbidden(n, wantimbal)) continue;
      printf("n=%d wantimbal=%d\n", n, wantimbal);
      bool have = solve();
      assert(have);
      verify();
    }
  }
}
int main() {
  run();
  return 0;
}
