#include <bits/stdc++.h>
const int maxn = 1e5 + 5;
const int pow2 = 1 << 20;
int fa[maxn], N;
int cnt = 1;
void dfs(int o, int n, int k) {
  if (k <= 1) {
    for (int i = o + 1; i <= n; i++) fa[i] = (i - o + 1) / 2 + o - 1;
    if (k == 1 && pow2 % (n - o + 2) == 0) {
      fa[n] = N;
      fa[n - 1] = N;
    }
    return;
  } else {
    fa[o + 1] = o;
    fa[n--] = o;
    dfs(o + 1, n, k - 1);
  }
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  N = n;
  if (n % 2 == 0) {
    printf("NO\n");
    return 0;
  }
  if (n == 1) {
    if (k == 0) {
      printf("YES\n");
      printf("0\n");
    } else
      printf("NO\n");
    return 0;
  }
  if (n == 9 && k == 2) {
    printf("NO\n");
    return 0;
  }
  if (pow2 % (n + 1) == 0) {
    if ((k >= 2 || k == 0) && k <= n / 2 - 1) {
      printf("YES\n");
      dfs(1, n, k);
      for (int i = 1; i <= n; i++) printf("%d ", fa[i]);
      printf("\n");
    } else
      printf("NO\n");
    return 0;
  } else {
    if (k >= 1 && k <= n / 2 - 1) {
      printf("YES\n");
      dfs(1, n, k);
      for (int i = 1; i <= n; i++) printf("%d ", fa[i]);
      printf("\n");
    } else
      printf("NO\n");
    return 0;
  }
  return 0;
}
