#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 7;   int ans[maxn];   int lowbit(int x) { return x & -x; }   bool is_two(int x) { return x == lowbit(x); }   bool dfs(int n, int k, int id) {     if (k == 1) {       printf( %d %d %d n , n, k, id);       if (is_two(n)) {         return false;       }       ans[id] = max(id - 2, 0);       for (int i = 2; i <= n; ++i) {         ans[id + i - 1] = id + i / 2 - 1;       }       return true;     } else if (k == 0) {       if (is_two(n)) {         ans[1] = 0;         for (int i = 2; i <= n; ++i) {           ans[i] = i / 2;         }         return true;       } else         return false;     } else {       while (k >= 2) {         ans[id] = max(id - 2, 0);         ans[id + 1] = id;         n -= 2;         k -= 1;         id += 2;       }       return dfs(n, k, id);     }   }   int main() {     int n, k;     scanf( %d%d , &n, &k);     int lim = max(0, (n - 3) / 2);     if (n % 2 == 0 || k > lim || (n == 9 && k == 2) ||         (!is_two(n + 1) && k == 0) || (is_two(n + 1) && k == 1)) {       printf( NO n );     } else {       int id = 1;       while (k >= 2) {         ans[id] = max(id - 2, 0);         ans[id + 1] = id;         n -= 2;         k -= 1;         id += 2;       }       ans[id] = max(id - 2, 0);       for (int i = 2; i <= n - 2; ++i) {         ans[id + i - 1] = id + i / 2 - 1;       }       if (is_two(n + 1)) {         if (k == 0)           ans[id + n - 2] = id + (n - 1) / 2 - 1,                        ans[id + n - 1] = id + n / 2 - 1;         else           ans[id + n - 2] = 2, ans[id + n - 1] = 2;       } else {         if (k == 0)           return printf( NO n ), 0;         else           ans[id + n - 2] = id + (n - 1) / 2 - 1,                        ans[id + n - 1] = id + n / 2 - 1;       }       printf( YES n );       for (int i = 1; i < id + n - 1; ++i) {         printf( %d  , ans[i]);       }       printf( %d n , ans[id + n - 1]);     }   }   