#include <bits/stdc++.h>
using namespace std;
const int N = 100003;
template <typename T>
void read(T &x) {
  int ch = getchar();
  x = 0;
  bool f = false;
  for (; ch < '0' || ch > '9'; ch = getchar()) f |= ch == '-';
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
int n, k, fa[N];
int EI(int x) { return x & -x; }
bool chk(int x) { return x == EI(x); }
int main() {
  read(n);
  read(k);
  if (!k) {
    if (n + 1 != EI(n + 1)) return puts("NO"), 0;
    puts("YES");
    for (int i = 1; i <= n; ++i) printf("%d%c", i >> 1, " \n"[i == n]);
    return 0;
  }
  if (!(n & 1) || k > (n - 3 >> 1) || (n == 9 && k == 2) ||
      (k == 1 && chk(n + 1)))
    return puts("NO"), 0;
  puts("YES");
  for (int i = 1; i < k; ++i) fa[i << 1] = fa[i << 1 | 1] = i * 2 - 1;
  for (int i = k * 2; i <= n; ++i) fa[i] = (i >> 1) + k - 1;
  if (chk(n - k * 2 + 3)) fa[n - 1] = fa[n] = 2;
  for (int i = 1; i <= n; ++i) printf("%d%c", fa[i], " \n"[i == n]);
}
