#include <bits/stdc++.h>
using namespace std;
bool f[63250];
int main() {
  long long a, b, n = 0, cnt = 0;
  cin >> a >> b;
  while ((n + 2) * (n + 1) / 2 <= a + b) n++;
  for (long long i = n; i >= 1; i--)
    if (a >= i) f[i] = true, ++cnt, a -= i;
  cout << cnt << "\n";
  for (long long i = 1; i <= n; i++)
    if (f[i]) cout << i << " ";
  cout << "\n" << n - cnt << "\n";
  for (long long i = 1; i <= n; i++)
    if (!f[i]) cout << i << " ";
  return 0;
}
