#include <bits/stdc++.h>
using namespace std;
int n, k, fa[100005];
bool check(int x) { return x - (x & -x) == 0; }
int main() {
  scanf("%d%d", &n, &k);
  int mx = max((n - 3) / 2, 0);
  if (k > mx || (n % 2 == 0) || (n == 9 && k == 2) ||
      (check(n + 1) && k == 1) || (!check(n + 1) && k == 0)) {
    printf("NO");
    return 0;
  }
  printf("YES\n");
  mx = 2 * max(k - 1, 0);
  for (register int i = 1; i <= mx; i += 2)
    fa[i] = max(i - 2, 0), fa[i + 1] = i;
  for (register int i = 1; i <= n - mx; i++) {
    if (i == 1)
      fa[i + mx] = max(0, mx - 1);
    else
      fa[i + mx] = i / 2 + mx;
  }
  if (check(n - mx + 1) && k) fa[n] = fa[n - 1] = 2;
  for (register int i = 1; i <= n; i++) printf("%d ", fa[i]);
}
