#include <bits/stdc++.h>
using namespace std;
long long int a, b;
long long int binarySearch(long long int low, long long int high) {
  long long int answer = 0LL;
  while (high >= low) {
    long long int mid = (low + high) / 2;
    if (mid * (mid + 1) <= 2 * (a + b)) {
      answer = mid;
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  return answer;
}
int main() {
  cin >> a >> b;
  int Max = a + b;
  long long int How_many = binarySearch(0, 1e9);
  vector<int> Day_One, Day_Two;
  vector<bool> done(How_many + 1, false);
  for (int i = How_many; i >= 1; i--) {
    if (done[i]) {
      continue;
    }
    if (a >= i) {
      Day_One.push_back(i);
      done[i] = true;
      a -= i;
    } else if (a > 0) {
      Day_One.push_back(a);
      done[a] = true;
      a = 0;
      b -= i;
      done[i] = true;
      Day_Two.push_back(i);
    } else {
      Day_Two.push_back(i);
      b -= i;
    }
  }
  cout << (int)Day_One.size() << "\n";
  for (int i = 0; i < (int)Day_One.size(); i++) {
    cout << Day_One[i] << " ";
  }
  cout << "\n";
  cout << (int)Day_Two.size() << "\n";
  for (int i = 0; i < (int)Day_Two.size(); i++) {
    cout << Day_Two[i] << " ";
  }
  cout << "\n";
  return 0;
}
