#include <bits/stdc++.h>
using namespace std;
bool pt(int n) { return !(n & (n - 1)); }
bool check(int n, int k) {
  if (n <= 0 or n % 2 == 0 or k < 0) return false;
  if (n <= 3) return k == 0;
  if (n == 5) return k == 1;
  if (n == 7) return k == 0 or k == 2;
  if (n == 9) return k == 1 or k == 3;
  return k <= (n - 3) / 2 and k != pt(n + 1);
}
vector<int> ans;
void build(int n, int k, int i, int par) {
  ans[i] = par;
  if (n == 1) return;
  if (n <= 11) {
    for (int a = 1; a <= (n - 1) / 2; a += 2) {
      int b = n - 1 - a;
      int rt = 2 * a <= b;
      for (int x = 0; x + rt <= k; ++x) {
        if (check(a, x) and check(b, k - x - rt)) {
          build(a, x, i + 1, i);
          build(b, k - x - rt, i + a + 1, i);
          return;
        }
      }
    }
  }
  if (k == 0) {
    build(n / 2, 0, i + 1, i);
    build(n / 2, 0, i + n / 2 + 1, i);
    return;
  }
  for (int p = 2; p - 1 < n - 1; p *= 2) {
    int a = p - 1;
    int b = n - 1 - a;
    int rt = (2 * a <= b) or (2 * b <= a);
    if (check(b, k - rt)) {
      build(a, 0, i + 1, i);
      build(b, k - rt, i + a + 1, i);
      return;
    }
  }
  build(1, 0, i + 1, i);
  build(n - 2, k - 1, i + 2, i);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  if (!check(n, k)) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n";
  ans.resize(n);
  build(n, k, 0, -1);
  for (int i = 0; i < n; ++i) {
    cout << ans[i] + 1 << ' ';
  }
  return 0;
}
