#include <bits/stdc++.h>
using namespace std;
int n, k;
int s[100005];
int main() {
  cin >> n >> k;
  if (n == 1 && k == 0) return puts("YES\n0"), 0;
  if (n % 2 == 0 || n - 3 < k * 2) return puts("NO"), 0;
  if (n == 9 && k == 2) return puts("NO"), 0;
  if (k == 1 && ((n + 1) & (-(n + 1))) == n + 1) return puts("NO"), 0;
  if (k == 0) {
    if (((n + 1) & (-(n + 1))) != n + 1) return puts("NO"), 0;
    for (int i = 1; i <= n; ++i) {
      s[i] = (i >> 1);
    }
    puts("YES");
    for (int i = 1; i <= n; ++i) printf("%d ", s[i]);
    return 0;
  }
  puts("YES");
  if (n == 3) return puts("0 1 1"), 0;
  int cnt = 1;
  for (int i = 1; i < k; ++i) {
    s[++cnt] = cnt - 1;
    s[++cnt] = cnt - 2;
  }
  for (int i = cnt + 1; i <= n; ++i) {
    s[i] = ((i - cnt - 1) >> 1) + cnt;
  }
  if (((n - cnt + 2) & (-(n - cnt + 2))) == n - cnt + 2) s[n] = 2, s[n - 1] = 2;
  for (int i = 1; i <= n; ++i) printf("%d ", s[i]);
  return 0;
}
