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