#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
bool mark[MAXN];
long long a, b, k, sum;
bool tag = 0;
int main() {
  ios::sync_with_stdio(false);
  cin >> a >> b;
  if (a > b) swap(a, b), tag = 1;
  k = 0, sum = 0;
  while (sum + k + 1 <= a + b) {
    ++k;
    sum += k;
  }
  int cnt = 0;
  for (int i = k; i >= 1; i--) {
    if (a >= i) {
      a -= i;
      mark[i] = 1;
      ++cnt;
    }
  }
  if (tag) {
    cout << k - cnt << endl;
    for (int i = 1; i <= k; i++)
      if (!mark[i]) cout << i << " ";
    cout << endl;
    cout << cnt << endl;
    for (int i = 1; i <= k; i++)
      if (mark[i]) cout << i << " ";
    cout << endl;
  } else {
    cout << cnt << endl;
    for (int i = 1; i <= k; i++)
      if (mark[i]) cout << i << " ";
    cout << endl;
    cout << k - cnt << endl;
    for (int i = 1; i <= k; i++)
      if (!mark[i]) cout << i << " ";
    cout << endl;
  }
  return 0;
}
