#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
const int MAX = 1e6 + 1;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;
int a, b;
bool check(int x) {
  int ra = a, rb = b;
  for (int i = x; i >= 1; --i) {
    if (ra > rb) swap(ra, rb);
    if (ra >= i)
      ra -= i;
    else if (rb >= i)
      rb -= i;
    else
      return false;
  }
  return true;
}
int main() {
  cin >> a >> b;
  int lb = 0, rb = max(a, b), ans = -1;
  vector<int> day1, day2;
  while (lb <= rb) {
    int mid = (lb + rb) / 2;
    if (check(mid))
      ans = mid, lb = mid + 1;
    else
      rb = mid - 1;
  }
  for (int i = ans; i >= 1; --i) {
    if (a > b) {
      if (b >= i)
        day2.push_back(i), b -= i;
      else
        day1.push_back(i), a -= i;
    } else {
      if (a >= i)
        day1.push_back(i), a -= i;
      else
        day2.push_back(i), b -= i;
    }
  }
  cout << day1.size() << endl;
  for (int i = 0; i < day1.size(); ++i) cout << day1[i] << ' ';
  cout << endl;
  cout << day2.size() << endl;
  for (int i = 0; i < day2.size(); ++i) cout << day2[i] << ' ';
  cout << endl;
  return 0;
}
