#include <bits/stdc++.h>
using namespace std;
template <typename T1 = int, typename T2 = int, typename T3 = int>
void debug(T1 x, T2 y = T2(), T3 z = T3()) {
  cout << x << " " << y << "  " << z << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int n, k;
  cin >> n >> k;
  long long int org = k;
  vector<bool> fixed(n + 1);
  if (k < n * (n + 1) / 2) {
    cout << -1 << endl;
    return 0;
  }
  k -= n * (n + 1) / 2;
  long long int right = n;
  long long int diff = n - 1;
  long long int left = 1;
  vector<long long int> p, p1;
  while (k && left <= right) {
    if (k < diff) {
      while (diff - k) {
        p.push_back(left);
        p1.push_back(left);
        left++;
        diff--;
      }
    }
    p.push_back(right);
    p1.push_back(left);
    if (right != left) {
      p.push_back(left);
      p1.push_back(right);
    }
    k -= diff;
    left++;
    right--;
    diff -= 2;
  }
  for (long long int i = left; i <= right; i++) {
    p.push_back(i);
    p1.push_back(i);
  }
  cout << (org - k) << endl;
  for (long long int x : p) cout << x << " ";
  cout << endl;
  for (long long int x : p1) cout << x << " ";
  cout << endl;
}
