#include <bits/stdc++.h>
using namespace std;
const long long MAXN = (long int)3e5 + 5;
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long a, b, prev;
  cin >> a >> b;
  long long n = (sqrt(1 + 8 * (a + b)) - 1) / 2;
  std::vector<long long> d1, d2;
  for (long long i = n; i > 0; i--) {
    if (a - i >= 0) {
      d1.push_back(i);
      a -= i;
    } else if (b - i >= 0) {
      d2.push_back(i);
      b -= i;
    }
  }
  cout << d1.size() << endl;
  for (auto i : d1) cout << i << " ";
  cout << endl;
  cout << d2.size() << endl;
  for (auto i : d2) cout << i << " ";
  cout << endl;
  return 0;
}
