#include <bits/stdc++.h>   using namespace std;   const int N = 1000001;   int n, kt[N], a[N], cnt, x[N];   long long k, s;   long long cal(int i) {     long long res = i;     return res * (res + 1) / 2;   }   int main() {     scanf( %d%lld , &n, &k);     if (k < cal(n)) {       printf( -1 );       return 0;     }     for (int i = n; i > 0; i--) {       int h = n - (n - i) / 2;       if (k - h < cal(i - 1)) h = k - cal(i - 1);       k -= h;       kt[h]++;       if (kt[h] == 2) a[++cnt] = h;     }     for (int i = 1; i <= n; i++) s += kt[i] * i;     printf( %lld n , s);     for (int i = 1; i <= n; i++) {       if (kt[i] == 1)         x[i] = i;       else if (kt[i] == 0) {         x[a[cnt]] = i;         x[i] = a[cnt];         cnt--;       }     }     for (int i = 1; i <= n; i++) printf( %d  , i);     printf(  n );     for (int i = 1; i <= n; i++) printf( %d  , x[i]);     return 0;   }   