#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solve(int tc = 0) {
  int a, b;
  cin >> a >> b;
  vector<int> A, B;
  long long s = a + b;
  int k = 0, used = 0;
  while (k + used <= s) {
    used += k;
    k++;
  }
  k--;
  for (int i = k; i >= 1; i--) {
    if (a >= i) {
      a -= i;
      A.push_back(i);
    } else {
      b -= i;
      B.push_back(i);
    }
  }
  cout << A.size() << "\n";
  ;
  for (auto x : A) cout << x << " ";
  cout << ""
       << "\n";
  ;
  cout << B.size() << "\n";
  ;
  for (auto x : B) cout << x << " ";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tc = 1;
  for (int t = 0; t < tc; t++) solve(t);
  return 0;
}
