#include <bits/stdc++.h>
using namespace std;
template <typename T>
istream& operator>>(istream& in, vector<T>& a) {
  for (auto& i : a) in >> i;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
  for (auto& i : a) {
    out << i << " ";
  }
  return out;
}
template <typename T, typename D>
istream& operator>>(istream& in, pair<T, D>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T, typename D>
ostream& operator<<(ostream& out, const pair<T, D>& a) {
  out << a.first << " " << a.second;
  return out;
}
const long long INFL = 9187201950435737471;
const long long nINFL = -9187201950435737472;
const long long INF = 2139062143;
const long long nINF = -2139062144;
const unsigned long long ULINF = numeric_limits<unsigned long long>::max();
const long double PI = acos(-1);
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rnd(seed);
inline void IO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const long long MAXN = 2e5;
const long long MAXE = 100 + 15;
const long long MOD = 1e9 + 7;
const double EPS = 1e-10;
void MyAssert(bool f = false) {
  if (!f) {
    cout << "NO";
    exit(0);
  }
}
long long timer = 0;
long long ans[MAXN];
set<long long> st;
void BuildTreeWith1(long long tl, long long tr) {
  if (tl == tr) {
    return;
  }
  long long childrenSz = tr - tl;
  tr--;
  long long leftSize = 0;
  while (leftSize * 3 < childrenSz) {
    leftSize = leftSize * 2 + 1;
  }
  long long tm = tl + leftSize - 1;
  long long curV = timer + 1;
  ans[++timer] = curV;
  BuildTreeWith1(tl, tm);
  ans[++timer] = curV;
  BuildTreeWith1(tm + 1, tr);
}
void solve() {
  for (long long i = 0; i < (20); ++i) {
    st.insert(1 << i);
  }
  long long n, k;
  cin >> n >> k;
  long long nn = n;
  if ((n & 1) == 0 || k > max(0ll, (n - 3) / 2)) {
    MyAssert();
  }
  while (n > 13) {
    long long curV = timer + 1;
    if (k == 0) {
      MyAssert(st.count(n + 1));
      BuildTreeWith1(0, n - 1);
      break;
    }
    if (k == 1) {
      MyAssert(!st.count(n + 1));
      BuildTreeWith1(0, n - 1);
      break;
    }
    if (k == 2 && st.count(n - 1)) {
      ans[++timer] = curV;
      BuildTreeWith1(0, 2);
      ans[++timer] = curV;
      k--;
      n -= 4;
    } else {
      ans[++timer] = curV;
      ans[++timer] = curV;
      k--;
      n -= 2;
    }
  }
  if (n == 13 && k == 4) {
    long long curV = timer + 1;
    ans[++timer] = curV;
    BuildTreeWith1(0, 2);
    ans[++timer] = curV;
    n -= 4;
    k--;
  }
  if (k == 0) {
    MyAssert(st.count(n + 1));
    BuildTreeWith1(0, n - 1);
  } else if (k == 1 && !st.count(n + 1)) {
    BuildTreeWith1(0, n - 1);
  } else if (k * 2 + 3 == n || (n == 11 && k == 2) || (n == 13 && k == 2)) {
    while (1) {
      long long curV = timer + 1;
      if (k == 0) {
        MyAssert(st.count(n + 1));
        BuildTreeWith1(0, n - 1);
        break;
      }
      if (k == 1) {
        MyAssert(!st.count(n + 1));
        BuildTreeWith1(0, n - 1);
        break;
      }
      if (k == 2 && st.count(n - 1)) {
        ans[++timer] = curV;
        BuildTreeWith1(0, 2);
        ans[++timer] = curV;
        k--;
        n -= 4;
      } else {
        ans[++timer] = curV;
        ans[++timer] = curV;
        k--;
        n -= 2;
      }
    }
  } else {
    MyAssert();
  }
  cout << "YES" << '\n';
  for (long long i = 0; i < nn; i++) {
    cout << ans[i] << ' ';
  }
}
signed main() {
  IO();
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
