#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b;
  cin >> a >> b;
  int sum = a + b;
  long long int last_value = 0;
  vector<int> inp((1e5) + 5);
  for (long long int i = 0; i < 1e5; i++) {
    long long int cur_sum = (i * (i + 1LL)) / 2LL;
    if (cur_sum > sum) {
      last_value = i;
      break;
    }
  }
  vector<int> ans1, ans2;
  long long int temp = last_value - 1LL;
  while (temp < a && temp > 0) {
    ans1.push_back(temp);
    inp[temp] = 1;
    a -= temp;
    temp = temp - 1;
  }
  if (a > 0) {
    if (inp[a] == 0) {
      ans1.push_back(a);
      inp[a]++;
    }
  }
  for (int i = 1; i < last_value; i++) {
    if (inp[i] == 0) ans2.push_back(i);
  }
  cout << ans1.size() << endl;
  for (int i = 0; i < ans1.size(); i++) cout << ans1[i] << " ";
  cout << endl;
  cout << ans2.size() << endl;
  for (int i = 0; i < ans2.size(); i++) cout << ans2[i] << " ";
  cout << endl;
  return 0;
}
