#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 10;
std::vector<long long> v, vv;
long long res;
long long a[N];
void solve() {
  long long a, b;
  cin >> a >> b;
  long long low = 0, high = 1e9;
  while (low + 1 < high) {
    long long mid = (low + high) / 2;
    if ((mid * (mid + 1)) / 2 <= a + b) {
      low = mid;
    } else {
      high = mid;
    }
  }
  if (a > b) swap(a, b), res = 1;
  for (int i = low; i >= 1; --i) {
    if (i <= a) {
      v.push_back(i);
      a -= i;
    } else {
      vv.push_back(i);
      b -= i;
    }
  }
  if (!res) {
    cout << v.size() << "\n";
    for (auto i : v) cout << i << " ";
    cout << "\n" << vv.size() << "\n";
    for (auto i : vv) cout << i << " ";
  } else {
    cout << vv.size() << "\n";
    for (auto i : vv) cout << i << " ";
    cout << "\n" << v.size() << "\n";
    for (auto i : v) cout << i << " ";
  }
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
