#include <bits/stdc++.h>
using namespace std;
bool can(long long n, long long k) {
  if (n % 2 == 0) return 0;
  if (k == 0) return !(n & (n + 1));
  if (k == 1) return n & (n + 1);
  return (k > 0 && k * 2 + 3 <= n) && !(k == 2 && n == 9);
}
long long i = 1;
void construct(long long n, long long k, long long a = 0) {
  cout << a << " ";
  long long j = i++;
  if (n <= 1) return;
  for (long long l = 1; l < n; l++) {
    long long r = n - l - 1;
    long long p = max(l, r) >= (min(l, r) * 2) ? k - 1 : k;
    if (can(l, 0) && can(r, p)) {
      construct(l, 0, j);
      construct(r, p, j);
      return;
    }
  }
}
int main() {
  long long n, k;
  cin >> n >> k;
  if (!can(n, k))
    cout << "NO\n";
  else {
    cout << "YES\n";
    construct(n, k);
  }
}
