#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e9;
const long long MAXN = (long long)1e5 + 100;
const long long MOD = (long long)1e9 + 7;
const long double EPS = (long double)1e-10;
long long power(long long x, long long n, long long mod = 1e9 + 7) {
  if (n == 0) return 1ll;
  if (n & 1ll) return power(x, n - 1ll, mod) * x % mod;
  long long tmp = power(x, n >> 1ll, mod);
  return (tmp * tmp) % mod;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
template <class t1, class t2>
inline bool cmin(t1 &a, const t2 &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class t1, class t2>
inline bool cmax(t1 &a, const t2 &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long dp[MAXN][4];
signed main() {
  iostream::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  mt19937 rnd(42);
  long long a, b;
  cin >> a >> b;
  vector<long long> A, B;
  long long cnt = 0;
  for (long long i = 0; i < MAXN; i++) {
    if (i * (i + 1) / 2 <= a + b) cnt = i;
  }
  for (long long i = cnt; i > 0; i--) {
    if (a >= i) {
      A.push_back(i);
      a -= i;
    } else {
      if (b >= i) {
        B.push_back(i);
        b -= i;
      }
    }
  }
  cout << (long long)A.size() << "\n";
  for (auto x : A) cout << x << " ";
  cout << "\n";
  cout << (long long)B.size() << "\n";
  for (auto x : B) cout << x << " ";
}
