#include <bits/stdc++.h>
using namespace std;
set<int> v1, v2;
int used[1000005];
int main() {
  cout.sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  for (int i = 1; a >= 0; i++) a -= i, used[i] = 1, v1.insert(i);
  used[abs(a)] = 0;
  v1.erase(abs(a));
  int last = -1;
  for (int i = 1; b >= 0; i++)
    if (!used[i]) b -= i, used[i] = 1, v2.insert(i), last = i;
  if (last != -1) v2.erase(last);
  cout << v1.size() << endl;
  for (int val : v1) cout << val << " ";
  cout << endl;
  cout << v2.size() << endl;
  for (int val : v2) cout << val << " ";
  cout << endl;
  return 0;
}
