#include <bits/stdc++.h>
using namespace std;
int n, k;
int ans[100000 + 10];
int p2 = 2 << 20;
void pt(int start, int num) {
  for (int i = 0; i < num; i++) {
    ans[start + i] = i / 2 + start;
  }
  return;
}
int main() {
  scanf("%d%d", &n, &k);
  if (n == 1 && k == 0) {
    printf("YES\n0\n");
    return 0;
  }
  if (n % 2 == 0) {
    printf("NO\n\n");
    return 0;
  }
  if ((n - 3) / 2 < k) {
    printf("NO\n\n");
    return 0;
  }
  if (n == 9 && k == 2) {
    printf("NO\n\n");
    return 0;
  }
  if (p2 % (n + 1) == 0 && k == 0) {
    pt(1, n);
    printf("YES\n");
    for (int i = 0; i < n; i++) {
      printf("%d ", ans[i]);
    }
    printf("\n");
  } else if (p2 % (n + 1) == 0 && k == 1 || p2 % (n + 1) != 0 && k == 0) {
    printf("NO\n\n");
  } else {
    int count = 1;
    while (k > 1) {
      ans[count * 2 - 1] = (count - 1) * 2 + 1;
      ans[count * 2] = (count - 1) * 2 + 1;
      count++;
      k--;
    }
    pt(count * 2 - 1, n - 2 * (count - 1));
    if (k == 1 && p2 % (n - 2 * (count - 1) + 1) == 0) {
      ans[n - 2] = 2;
      ans[n - 1] = 2;
    }
    printf("YES\n");
    for (int i = 0; i < n; i++) {
      printf("%d ", ans[i]);
    }
    printf("\n");
  }
  return 0;
}
