#include <bits/stdc++.h>
using namespace std;
template <typename __T>
inline void read(__T &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
pair<int, int> mp(int a, int b) { return make_pair(a, b); }
const int mod = 1000000007;
long long qpow(long long a, long long b = mod - 2) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return ans;
}
int popc(int n) { return __builtin_popcount(n); }
int n, k;
bool check(int n, int k) {
  if ((n & 1) == 0) return 0;
  if (n == 1 && k == 0) return 1;
  if (n == 9 && k == 2) return 0;
  int sb = (n - 3) / 2;
  if (k > sb) return 0;
  if (k < 0) return 0;
  if (n < 0) return 0;
  if (popc(n + 1) == 1) return k != 1;
  return k != 0;
}
int tot = 0;
int faa[100005];
bool ckv(int a, int b) { return a >= 2 * b || b >= 2 * a; }
void dfs(int n, int k, int fa) {
  faa[++tot] = fa;
  int now = tot;
  if (n == 1) return;
  if (k == 0) {
    dfs(n / 2, 0, now);
    dfs(n / 2, 0, now);
    return;
  }
  bool jb = 0;
  for (int a = 1; a <= n && jb == 0; a += 2) {
    bool fg = ckv(a, n - a - 1);
    int mv = min(a - 1, k);
    for (int x = 0; x <= mv; x++) {
      if (check(a, x) == 0) continue;
      if (check(n - a - 1, k - x - fg) == 0) continue;
      jb = 1;
      dfs(a, x, now);
      dfs(n - a - 1, k - x - fg, now);
      break;
    }
  }
  if (jb == 0) cout << "SMJB" << n << ' ' << k << endl;
}
int main() {
  int T;
  T = 1;
  while (T--) {
    read(n);
    read(k);
    if (check(n, k) == 0) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
      dfs(n, k, 0);
      for (int i = 1; i <= n; i++) cout << faa[i] << ' ';
      cout << endl;
    }
  }
  return 0;
}
