#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
const long long INF = 2e18;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long a, b, i = 1, s = 0;
  cin >> a >> b;
  set<long long> sa, sb;
  while (i * (i + 1) / 2 <= a + b) {
    s = i;
    i++;
  }
  while (1) {
    if (!s) break;
    if (a >= s) {
      sa.insert(s);
      a -= s;
    } else if (b >= s) {
      sb.insert(s);
      b -= s;
    }
    s--;
  }
  cout << sa.size() << "\n";
  for (long long x : sa) {
    cout << x << " ";
  }
  if (sa.size()) cout << "\n";
  cout << sb.size() << "\n";
  for (long long x : sb) {
    cout << x << " ";
  }
  return 0;
}
