#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;
template <typename T>
T mul(T a, T b) {
  return (1LL * a * b) % MOD;
}
template <typename T>
T add(T a, T b) {
  return (a + b) % MOD;
}
template <typename T>
T sub(T a, T b) {
  return ((a - b) % MOD + MOD) % MOD;
}
template <typename T, typename... V>
T mul(T t, V... v) {
  return mul(t, mul(v...));
}
template <typename T, typename... V>
T add(T t, V... v) {
  return add(t, add(v...));
}
template <typename T, typename... V>
T sub(T t, V... v) {
  return sub(t, sub(v...));
}
int P[100003];
bool build(int x, int n, int k);
bool build(int x, int x1, int n1, int k1, int x2, int n2, int k2) {
  P[x1] = x;
  P[x2] = x;
  build(x1, n1, k1);
  build(x2, n2, k2);
  return 1;
}
bool CASE1(int x, int n, int k) {
  if (n == 3) {
    build(x, x + 1, 1, 0, x + 2, 1, 0);
  }
  if (n == 5) {
    build(x, x + 1, 1, 0, x + 2, 3, 0);
  }
  if (n == 9) {
    if (k == 2) return 0;
    build(x, x + 1, 1, 0, x + 2, 7, k - 1);
  }
  if (n == 11) {
    if (k & 1)
      build(x, x + 1, 3, 0, x + 4, 7, k - 1);
    else
      build(x, x + 1, 1, 0, x + 2, 9, k - 1);
  }
  return 1;
}
bool pbt(int n) { return ((n + 1) & (-(n + 1))) == (n + 1); }
bool build(int x, int n, int k) {
  if (n == 1) return 1;
  if (n % 2 == 0) return 0;
  if (k > n / 2 - 1) return 0;
  if (!pbt(n) && k == 0) return 0;
  if (pbt(n) && k == 1) return 0;
  if (n == 9 && k == 2) return 0;
  if (pbt(n)) {
    if (k)
      build(x, x + 1, 1, 0, x + 2, n - 2, k - 1);
    else
      build(x, x + 1, n / 2, 0, x + 1 + n / 2, n / 2, 0);
  } else if (n <= 11) {
    CASE1(x, n, k);
  } else if (pbt(n - 2)) {
    if (k == 1 || k > 2)
      build(x, x + 1, 1, 0, x + 2, n - 2, k - 1);
    else
      build(x, x + 1, 3, 0, x + 4, n - 4, 1);
  } else {
    if (k > 1)
      build(x, x + 1, 1, 0, x + 2, n - 2, k - 1);
    else {
      for (int i = 2; i <= n; i += i) {
        int pbt1 = i - 1;
        int nod = n - pbt1 - 1;
        if (pbt(nod)) {
          build(x, x + 1, pbt1, 0, x + 1 + pbt1, nod, 0);
          break;
        }
        if (max(pbt1, nod) < 2 * min(pbt1, nod)) {
          build(x, x + 1, pbt1, 0, x + 1 + pbt1, nod, 1);
          break;
        }
      }
    }
  }
  return 1;
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  if (!build(1, n, k)) {
    printf("NO\n");
  } else {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%d%c", P[i], (i == n) ? '\n' : ' ');
  }
}
