#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 100;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
long long t, a[maxn];
bool isp[maxn];
bool ok(long long x, long long y) {
  if (x == 1 && y == 0) return 1;
  if (x % 2 == 0) return 0;
  if (y > (x - 3) / 2) return 0;
  if (x == 9 && y == 2) return 0;
  if (y < 0) return 0;
  if (y == 0) return isp[x + 1];
  if (y == 1) return !isp[x + 1];
  return 1;
}
void tr(long long v, long long x) {
  if (x == 0) return;
  long long u = ++t;
  a[u] = v;
  tr(u, x / 2);
  tr(u, x / 2);
  return;
}
void solve(long long v, long long x, long long y) {
  long long u = ++t;
  a[u] = v;
  for (long long i = 1; i < x - 1; i = i * 2 + 1) {
    long long z = y - (2 * i <= x - 1 - i || i >= (x - 1 - i) * 2);
    if (ok(x - 1 - i, z)) {
      tr(u, i);
      solve(u, x - i - 1, z);
      return;
    }
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long x = 1;
  while (x < maxn) {
    isp[x] = 1;
    x <<= 1;
  }
  long long n, k;
  cin >> n >> k;
  if (!ok(n, k)) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  solve(0, n, k);
  for (long long i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
