#include <bits/stdc++.h>
using namespace std;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
void solve() {
  long long a, b;
  cin >> a >> b;
  long long maxa = 1000000;
  long long mina = -1;
  while (maxa - mina > 1) {
    long long mid = mina + (maxa - mina) / 2;
    if (1LL * mid * (mid + 1) / 2 <= a + b)
      mina = mid;
    else
      maxa = mid;
  }
  set<int> as, bs;
  long long sum = 0;
  for (int i = 1; i < mina + 1; i++) {
    if (sum + i <= a) {
      sum += i;
    } else {
      int to_swap = sum + i - a;
      for (int j = 1; j < i + 1; j++) {
        if (j == to_swap)
          continue;
        else
          as.insert(j);
      }
      for (int j = 1; j < mina + 1; j++) {
        if (as.count(j) == 0) bs.insert(j);
      }
      cout << (int)as.size() << '\n';
      for (auto i : as) cout << i << " ";
      cout << '\n';
      cout << (int)bs.size() << '\n';
      for (auto i : bs) cout << i << " ";
      cout << '\n';
      return;
    }
  }
  for (int i = 1; i < mina + 1; i++) as.insert(i);
  for (int j = 1; j < mina + 1; j++) {
    if (as.count(j) == 0) bs.insert(j);
  }
  cout << (int)as.size() << '\n';
  for (auto i : as) cout << i << " ";
  cout << '\n';
  cout << (int)bs.size() << '\n';
  for (auto i : bs) cout << i << " ";
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
