#include <bits/stdc++.h>
const int MAXN = 1e5;
int n, K, fa[MAXN + 5];
int main() {
  scanf("%d %d", &n, &K);
  if (!(n & 1)) return puts("NO"), 0;
  if (!K) {
    if (n & (n + 1)) return puts("NO"), 0;
    puts("YES");
    for (int i = 1; i <= n; ++i) printf("%d%c", i >> 1, i ^ n ? ' ' : '\n');
    return 0;
  }
  if (2 * K + 3 > n) return puts("NO"), 0;
  for (int i = 2; i <= 2 * K - 2; i += 2) fa[fa[i] = i - 1] = i - 3;
  fa[2 * K - 1] = 2 * K - 3;
  int ontr = n - 2 * K + 2;
  if (!(ontr & (ontr + 1))) {
    if (n <= 9 || K == 1) return puts("NO"), 0;
    ontr -= 2, fa[n] = fa[n - 1] = 2;
  }
  for (int i = 2; i <= ontr; ++i) fa[i + 2 * K - 2] = 2 * K - 2 + (i >> 1);
  puts("YES"), fa[1] = 0;
  for (int i = 1; i <= n; ++i) printf("%d%c", fa[i], i ^ n ? ' ' : '\n');
  return 0;
}
