#include <bits/stdc++.h>
using namespace std;
const int N = 998244353;
vector<int> a, b;
void print() {
  cout << a.size() << '\n';
  for (int i = 0; i < a.size(); i++) cout << a[i] << " ";
  cout << '\n';
  cout << b.size() << '\n';
  for (int i = 0; i < b.size(); i++) cout << b[i] << " ";
}
int main() {
  long long int x, y, s = 0;
  cin >> x >> y;
  s = x + y;
  long long int used = 0;
  int k = 1;
  while (used + k <= s) {
    used += k;
    ++k;
  }
  --k;
  for (int i = k; i >= 1; --i) {
    if (i <= x) {
      a.push_back(i);
      x -= i;
    } else {
      b.push_back(i);
      y -= i;
    }
  }
  print();
  return 0;
}
