#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long MAX = 510000;
const long long INF = 1LL << 60;
const long long MOD = 1000000007LL;
using namespace std;
int main() {
  long long a, b;
  scanf("%lld %lld", &a, &b);
  long long sum = a + b;
  long long l = 0;
  long long r = (1LL << 30);
  while (r - l > 1) {
    long long m = (l + r) / 2;
    if (m * (m + 1) / 2 <= sum) {
      l = m;
    } else {
      r = m;
    }
  }
  long long x = l;
  vector<long long> res1, res2;
  vector<long long> used(x + 1, false);
  for (long long i = x; i >= 1; i--) {
    if (a - i >= 0) {
      a -= i;
      res1.push_back(i);
      used[i] = true;
    }
  }
  for (long long i = x; i >= 1; i--) {
    if (used[i]) continue;
    if (b > 0) {
      res2.push_back(i);
    }
  }
  long long sz1 = res1.size();
  long long sz2 = res2.size();
  printf("%lld\n", sz1);
  for (long long i = 0; i < sz1; i++) {
    printf("%lld", res1[i]);
    if (i == sz1 - 1)
      puts("");
    else
      printf(" ");
  }
  printf("%lld\n", sz2);
  for (long long i = 0; i < sz2; i++) {
    printf("%lld", res2[i]);
    if (i == sz2 - 1)
      puts("");
    else
      printf(" ");
  }
  return 0;
}
