#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
int s[MAXN];
int isComplete(int n) { return (n & (n + 1)) == 0; }
int gen(int n, int niche) {
  for (int i = 2; i <= niche; i += 2) {
    s[i] = i / 2;
    s[i + 1] = i / 2;
  }
  int last = 1;
  for (int i = niche + 1; i <= n; i += 2) {
    s[i] = i + 1;
    s[last] = i + 1;
    last = i + 1;
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  if (n % 2 == 0) {
    cout << "NO" << endl;
    return 0;
  }
  int leaves = (n + 1) / 2;
  int hi = leaves - 2;
  int lo = 0;
  if (hi < 0) hi = 0;
  if (!isComplete(n)) lo++;
  if (k < lo || hi < k) {
    cout << "NO" << endl;
    return 0;
  }
  if (k == 1 && isComplete(n)) {
    cout << "NO" << endl;
    return 0;
  }
  if (isComplete(n - 2 * k)) {
    gen(n, n - 2 * k);
  } else {
    assert(k > 0);
    if (!isComplete(n - 2 * (k - 1))) {
      gen(n, n - 2 * (k - 1));
    } else {
      assert(k > 1);
      if (k == 2) {
        cout << "NO" << endl;
        return 0;
      }
      gen(n, n - 2 * (k - 2));
      int niche = n - 2 * (k - 2);
      s[niche - 2] = n - 1;
      s[niche - 3] = n - 1;
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << s[i] << " ";
  return 0;
}
