#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int x = 0;
  int sum = n + m;
  int ss = 0;
  while (ss <= sum) {
    x++;
    ss = ss + x;
  }
  x--;
  int a[600005];
  int b[600005];
  int j = 0;
  int k = 0;
  for (int i = x; i > 0; i--) {
    if (i <= n) {
      a[j] = i;
      j++;
      n = n - i;
    } else {
      b[k] = i;
      k++;
      m = m - i;
    }
  }
  cout << j << endl;
  for (int i = 0; i < j; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  cout << k << endl;
  for (int i = 0; i < k; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
}
