#include <bits/stdc++.h>
using namespace std;
const long long D = 30;
long long deg[D] = {1};
vector<long long> ans;
long long check() {
  vector<long long> sz(ans.size() + 1);
  vector<pair<long long, long long> > son(ans.size() + 1);
  long long ret = 0;
  for (long long i = ans.size() - 1; i >= 0; --i) {
    ++sz[i + 1];
    sz[ans[i]] += sz[i + 1];
    (!son[ans[i]].first ? son[ans[i]].first : son[ans[i]].second) = sz[i + 1];
    if (son[i + 1].first)
      ret += son[i + 1].first * 2 <= son[i + 1].second ||
             son[i + 1].first >= son[i + 1].second * 2;
  }
  return ret;
}
void make0(long long v, long long p, long long sz) {
  ans.push_back(p);
  for (long long i = 0; i < (long long)sz / 2; ++i) {
    ans.push_back(v + i);
    ans.push_back(v + i);
  }
}
long long make1(long long v, long long p, long long sz) {
  ans.push_back(p);
  long long half = *lower_bound(deg, deg + D, sz / 2);
  if (half <= (sz - 1 - half) * 2) {
    make0(v + 1, v, half);
    return half;
  } else {
    half = (half + 1 >> 1) - 1;
    if (half * 2 >= sz - 1 - half) {
      make0(v + 1, v, half);
      return half;
    } else
      for (long long i = 0; i < D; ++i)
        if (*lower_bound(deg, deg + D, sz - 1 - deg[i]) == sz - 1 - deg[i]) {
          make0(v + 1, v, deg[i]);
          make0(v + 1 + deg[i], v, sz - 1 - deg[i]);
          return sz - 1;
        }
  }
}
void solve1(long long sz, long long pv, long long v) {
  while (sz) {
    long long d = make1(v, pv, sz);
    sz -= d + 1;
    pv = v;
    v += d + 1;
  }
}
void solve() {
  for (long long i = 0; i < (long long)D; ++i) deg[i] = (1 << i) - 1;
  long long n, k;
  cin >> n >> k;
  long long sk = k;
  if (!(n & 1) || (k == 0 && *lower_bound(deg, deg + D, n) != n) ||
      (k == 1 && *lower_bound(deg, deg + D, n) == n) || (k > (n - 2) / 2)) {
    cout << "NO";
    return;
  }
  if (k == 0)
    make0(1, 0, n);
  else if (k == 1)
    solve1(n, 0, 1);
  else {
    long long sz = n, pv = 0, v = 1;
    while (k > 2) {
      ans.push_back(pv);
      ans.push_back(v);
      --k;
      -- --sz;
      pv = v;
      ++ ++v;
    }
    if (*lower_bound(deg, deg + D, sz - 2) != sz - 2) {
      ans.push_back(pv);
      ans.push_back(v);
      solve1(sz - 2, v, v + 2);
    } else {
      if (sz == n) {
        ans.push_back(0);
        ans.push_back(1);
        ans.push_back(2);
        ans.push_back(2);
      } else {
        ans.push_back(pv);
        ans.push_back(v);
        ans.push_back(2);
        ans.push_back(2);
      }
      solve1(sz - 4, v, v + 4);
    }
  }
  if (check() == sk) {
    cout << "YES\n";
    for (long long x : ans) cout << x << " ";
  } else
    cout << "NO";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
