#include <bits/stdc++.h>
using namespace std;
int dt[][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {0, 0}};
const int N = 1e5 + 5;
int s[N];
bool vis[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int a, b;
  cin >> a >> b;
  for (int i = (1); i <= (1e5); ++i) s[i] = i;
  int cnt = 0;
  long long sum = 0;
  for (int i = 1;; ++i) {
    if (sum + i > a + b) break;
    sum += i;
    ++cnt;
  }
  int sum2 = 0, cnt2 = 0;
  for (int i = cnt; i >= (1); --i) {
    if (sum2 + i <= a) {
      sum2 += i;
      vis[i] = 1;
      ++cnt2;
    }
  }
  cout << cnt2 << endl;
  for (int i = (1); i <= (cnt); ++i) {
    if (vis[i]) cout << i << " ";
  }
  cout << endl;
  cout << cnt - cnt2 << endl;
  for (int i = (1); i <= (cnt); ++i) {
    if (!vis[i]) cout << i << " ";
  }
}
