#include <bits/stdc++.h>
using namespace std;
void show(vector<long long int> &a) {
  cout << a.size() << endl;
  for (int i = 0; i < a.size(); i++) cout << a[i] << " ";
  cout << endl;
}
int main() {
  long long int a, b;
  cin >> a >> b;
  vector<long long int> v1, v2;
  long long int k = 0;
  for (; (k + 1) * (k + 2) / 2 <= a + b; k++)
    ;
  long long int sum = k * (k + 1) / 2;
  long long int k1;
  for (k1 = k; k1 > 0 && b >= k1; k1--) {
    b -= k1;
    v2.push_back(k1);
  }
  if (b && b <= k1) v2.push_back(b);
  for (long long int i = 1; i <= k1; i++)
    if (i != b) v1.push_back(i);
  show(v1);
  show(v2);
}
