#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int s[maxn] = {};
void create2(int i, int n) {
  s[i + 1] = i;
  s[i + 2] = i;
  if (n - 2 > 0) create2(i + 2, n - 2);
}
bool create(int i, int n, int k) {
  if (n < 2 * k + 2) {
    return false;
  }
  if (n == 0) return true;
  if (n == 2 * k + 2) {
    create2(i, n);
    return true;
  }
  if (k >= 2) {
    if (n > 11) {
      while (n > 11 && k >= 2 && (k > 2 || ((n) & (n - 1)) != 0)) {
        s[i + 1] = i;
        s[i + 2] = i;
        i = i + 2;
        k--;
        n -= 2;
      }
      if (k == 2 && n > 11) {
        s[i + 1] = s[i + 4] = i;
        s[i + 2] = s[i + 3] = i + 1;
        return create(i + 4, n - 4, 1);
      }
      return create(i, n, k);
    }
  }
  if (n == 2 * k + 4) {
    if (n < 10) return false;
    s[i + 1] = s[i + 4] = i;
    s[i + 2] = s[i + 3] = i + 1;
    create2(i + 4, n - 4);
    return true;
  }
  int nn = n;
  nn -= 2;
  int nl = nn / 4 * 2, nr = nn - nl;
  if (k == 1) {
    nn += 2;
    int p = 1, q = 1;
    while (true) {
      p *= 2;
      nl = q - 2;
      if (p + q - 2 == nn) k = 0;
      if (p + q - 2 >= nn) break;
      q *= 2;
      nl = p - 2;
      if (p + q - 2 == nn) return false;
      if ((p + q - 2) > nn) break;
    }
    nr = nn - 2 - nl;
  }
  int kl = max(min((nl - 2) / 2, k / 2), 0), kr = k - kl;
  s[i + 1] = i;
  s[i + nl + 2] = i;
  return create(i + 1, nl, kl) && create(i + nl + 2, nr, kr);
}
int main() {
  int n, k;
  cin >> n >> k;
  if (n == 1 && k == 0) {
    printf("YES\n0");
    return 0;
  }
  if (((n + 1) & (n)) != 0 && k == 0) {
    cout << "NO";
    return 0;
  }
  if (((n + 1) & (n)) == 0 && k == 1) {
    cout << "NO";
    return 0;
  }
  if (n % 2 == 0 || k > (n - 3) / 2) {
    cout << "NO";
    return 0;
  }
  if (!create(1, n - 1, k)) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; ++i) {
    printf("%d ", s[i]);
  }
}
