#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  ;
  long long n, m;
  cin >> n >> m;
  long long tot = n + m;
  int cnt = 1;
  vector<int> vai;
  vector<int> a;
  vector<int> b;
  while (tot > 0) {
    if (tot - cnt >= 0) vai.push_back(cnt);
    tot -= cnt;
    cnt++;
  }
  reverse(vai.begin(), vai.end());
  if (n <= m) {
    for (int x : vai) {
      if (x <= n) {
        a.push_back(x);
        n -= x;
      } else {
        b.push_back(x);
      }
    }
  } else {
    swap(n, m);
    for (int x : vai) {
      if (x <= n) {
        a.push_back(x);
        n -= x;
      } else {
        b.push_back(x);
      }
    }
    swap(a, b);
  }
  assert(n == 0);
  cout << a.size() << endl;
  for (int x : a) cout << x << " ";
  cout << endl;
  cout << b.size() << endl;
  for (int x : b) cout << x << " ";
  cout << endl;
}
