#include <bits/stdc++.h>
using namespace std;
long long N, K;
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> K;
  long long mintime = N * (N + 1) / 2;
  if (K < mintime) {
    cout << "-1" << endl;
  } else {
    long long max_inc = K - mintime;
    vector<long long> sol(N);
    long long to_skip = 1e10;
    long long i = 0;
    for (; i < N / 2; ++i) {
      long long max_dec = N - 2 * i - 1;
      if (max_dec <= max_inc) {
        sol[i] = i + 1 + max_dec;
        max_inc -= max_dec;
      } else {
        sol[i] = i + 1 + max_inc;
        to_skip = i + 1 + max_inc;
        max_inc = 0;
        i++;
        break;
      }
    }
    for (long long j = 0; i + j < N; ++j) {
      sol[i + j] = j + (j + 1 >= to_skip ? 2 : 1);
    }
    long long ans = 0;
    for (long long j = 0; j < N; ++j) ans += max(j + 1, sol[j]);
    cout << ans << endl;
    for (long long j = 0; j < N; ++j) cout << j + 1 << " ";
    cout << endl;
    for (long long j = 0; j < N; ++j) cout << sol[j] << " ";
    cout << endl;
  }
  return 0;
}
