#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int mod = 998244353;
const int INF = 2147483647;
vector<int> V1, V2;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int x, y;
  cin >> x >> y;
  int l = 0, r = 100000;
  while (l < r) {
    int m = (l + r + 1) / 2;
    bool ok = 1;
    int x1 = x, y1 = y;
    for (int i = m; i >= 1; i--) {
      if (x1 > y1)
        x1 -= i;
      else
        y1 -= i;
      if (x1 < 0 || y1 < 0) {
        ok = 0;
        break;
      }
    }
    if (ok)
      l = m;
    else
      r = m - 1;
  }
  for (int i = l; i >= 1; i--) {
    if (x > y)
      x -= i, V1.push_back(i);
    else
      y -= i, V2.push_back(i);
  }
  cout << V1.size() << '\n';
  for (int i = 0; i < V1.size(); i++) cout << V1[i] << ' ';
  cout << '\n';
  cout << V2.size() << '\n';
  for (int i = 0; i < V2.size(); i++) cout << V2[i] << ' ';
  cout << '\n';
  return 0;
}
