#include <bits/stdc++.h>
using namespace std;
int next() {
  int x;
  cin >> x;
  return x;
}
long long lnext() {
  long long x;
  cin >> x;
  return x;
}
int main() {
  cout.precision(20);
  ios_base::sync_with_stdio(false);
  long long a = lnext();
  long long b = lnext();
  if (a == 0 && b == 0) {
    cout << "0\n\n0\n\n";
    return 0;
  }
  long long cnt = 0;
  while (cnt * (cnt + 1) / 2 <= a + b) {
    cnt++;
  }
  cnt--;
  vector<long long> fora;
  vector<long long> forb;
  vector<bool> need(cnt + 1, true);
  need[0] = false;
  while (cnt > 0 && cnt <= a) {
    fora.push_back(cnt);
    a -= cnt;
    need[cnt] = false;
    cnt--;
  }
  if (a > 0 && cnt > 0) {
    need[a] = false;
    cnt = 0;
    fora.push_back(a);
    a = 0;
  }
  for (int i = 0; i < need.size(); i++)
    if (need[i]) forb.push_back(i);
  cout << fora.size() << "\n";
  for (auto x : fora) cout << x << " ";
  cout << "\n";
  cout << forb.size() << "\n";
  for (auto x : forb) cout << x << " ";
  cout << "\n";
}
