#include <bits/stdc++.h>
using namespace std;
long long a, b;
bool used[1000005];
int main() {
  cin >> a >> b;
  long long max_num = 0, s = 0, max_id;
  for (;; max_num++) {
    if (s + max_num + 1 > a + b) break;
    s += max_num + 1;
    max_id = max_num;
  }
  s = 0;
  int cnt = 0;
  for (long long i = max_num + 1; i > 1; i--) {
    if (s + i - 1 > a) {
      used[a - s] = 1;
      if (a - s) cnt++;
      break;
    }
    used[i - 1] = 1;
    cnt++;
    s += i - 1;
  }
  cout << cnt << "\n";
  for (int i = 1; i <= max_num; i++) {
    if (used[i]) {
      cout << i << " ";
    }
  }
  cout << "\n" << max_num - cnt << "\n";
  for (int i = 1; i <= max_num; i++) {
    if (!used[i]) {
      cout << i << " ";
    }
  }
}
