#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long a[300001];
long long s[300001];
long long cnt[2];
bool used[300001];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  long long x = 0;
  while (x * (x + 1) <= a + b + a + b) x++;
  x--;
  long long n = 0;
  for (long long i = x; i >= 1; i--) {
    if (i <= a) {
      a -= i;
      used[i] = true;
      n++;
    }
  }
  cout << n << '\n';
  for (long long i = 1; i <= x; i++) {
    if (used[i]) cout << i << " ";
  }
  cout << '\n' << x - n << '\n';
  for (long long i = 1; i <= x; i++) {
    if (!used[i]) cout << i << " ";
  }
  return 0;
}
