#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
bool prime[200001];
long long f[300001];
long long pow1(long long x, long long y) {
  long long res = 1;
  x = x % mod;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long divide(long long n) { return pow1(n, mod - 2); }
long long ncr(long long n, long long r) {
  if (n < r) return 0;
  return (f[n] * ((divide(f[r]) * divide(f[n - r])) % mod)) % mod;
}
void sieve() {
  memset(prime, true, sizeof(prime));
  for (long long i = 2; i * i <= 200000; i++)
    if (prime[i])
      for (long long j = i * i; j <= 200000; j += i) prime[j] = false;
  prime[0] = prime[1] = false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b, i, n = 0, x, sum = 0;
  cin >> a >> b;
  for (i = 1; i <= a + b; i++) {
    sum += i;
    if (sum > a + b) break;
  }
  x = --i;
  long long arr[x + 1];
  memset(arr, 0, sizeof(arr));
  for (i = x; i >= 1; i--) {
    if (a - i >= 0) {
      arr[i] = 1;
      n++;
      a -= i;
    }
  }
  cout << n << endl;
  for (i = 1; i <= x; i++)
    if (arr[i]) cout << i << " ";
  cout << "" << endl;
  cout << x - n << endl;
  for (i = 1; i <= x; i++)
    if (!arr[i]) cout << i << " ";
  return 0;
}
