#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 1;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
int n, k, fa[100005];
bool ispw[200005];
bool chk(int n, int k) {
  if (n == 1 && k == 0) return 1;
  if (n % 2 == 0 || k > n / 2 - 1) return 0;
  if (n == 9 && k == 2) return 0;
  if (ispw[n + 1])
    return k != 1;
  else
    return k != 0;
}
void build(int l, int r, int k) {
  if (l == r) return;
  int len = r - l + 1;
  for (int i = 1; i <= len; i += 2) {
    int j = len - 1 - i, nk = k;
    if (i * 2 <= j || j * 2 <= i) nk--;
    if (nk < 0) continue;
    for (register int p = (0); p <= (min(nk, max(0, i / 2 - 1))); ++p)
      if (chk(i, p) && chk(j, nk - p)) {
        fa[l + 1] = l, fa[l + i + 1] = l;
        build(l + 1, l + i, p);
        build(l + i + 1, r, nk - p);
        return;
      }
  }
}
int main() {
  int x = 1;
  while (x <= 100000) {
    ispw[x] = 1;
    x *= 2;
  }
  n = read(), k = read();
  if (!chk(n, k))
    puts("NO");
  else {
    puts("YES");
    build(1, n, k);
    for (register int i = (1); i <= (n); ++i) cout << fa[i] << ' ';
  }
  return 0;
}
