#include <bits/stdc++.h>
const int MAXN = 100005;
using namespace std;
int pa[MAXN], is_bal[MAXN];
vector<int> bal;
int exist(int n, int k) {
  if (n % 2 == 0) return 0;
  if (n == 9 && k == 2) return 0;
  if (n == 1) return k == 0;
  if (k >= n / 2) return 0;
  if (is_bal[n]) return k != 1;
  return k != 0;
}
void build(int n, int k, int root) {
  if (n == 1) {
    return;
  }
  for (int l : bal) {
    int r = n - 1 - l;
    if (r <= 0) break;
    int imb = (min(l, r) * 2 < max(l, r));
    if (imb > k) continue;
    if (exist(r, k - imb)) {
      build(l, 0, root + 1);
      build(r, k - imb, root + 1 + l);
      pa[root + 1] = pa[root + 1 + l] = root;
      return;
    }
  }
  assert(0);
}
int main() {
  bal.push_back(1);
  is_bal[1] = 1;
  while (bal.back() * 2 + 1 <= MAXN) {
    bal.push_back(bal.back() * 2 + 1);
    is_bal[bal.back()] = 1;
  }
  int n, k;
  cin >> n >> k;
  if (!exist(n, k)) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    build(n, k, 1);
    for (int i = 1; i <= n; i++) {
      cout << pa[i] << " \n"[i == n];
    }
  }
}
