#include <bits/stdc++.h>
using namespace std;
int N, K, cnt;
bool can(int n, int k) {
  if (!(n & 1)) return false;
  if (k == 0) return (n & (n + 1)) ? false : true;
  if (k == 1) return (n & (n + 1)) ? true : false;
  if (n == 9 && k == 2) return false;
  return k > 0 && k * 2 + 3 <= n;
}
void solve(int n, int k, int p) {
  printf("%d ", p);
  cnt++;
  int x = cnt;
  if (n == 1) return;
  for (int l = 1; l <= n; l = l * 2 + 1) {
    int r = n - l - 1;
    int kr = k;
    if (max(l, r) >= 2 * min(l, r)) kr--;
    if (can(l, 0) && can(r, kr)) {
      solve(l, 0, x);
      solve(r, kr, x);
      break;
    }
  }
  return;
}
int main() {
  scanf("%d %d", &N, &K);
  if (!can(N, K))
    puts("NO");
  else {
    puts("YES");
    solve(N, K, 0);
    puts("");
  }
  return 0;
}
