#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int a, b;
  cin >> a >> b;
  set<int> sa, sb;
  int i;
  for (i = 1; true; i++) {
    if (a >= i) {
      sa.insert(i);
      a -= i;
    } else {
      if (a == 0) break;
      int d = i - a;
      if (b >= d) {
        b -= d;
        sa.erase(d);
        sb.insert(d);
        sa.insert(i);
      }
      i++;
      break;
    }
  }
  while (true) {
    if (b >= i) {
      b -= i;
      sb.insert(i);
    } else {
      break;
    }
    i++;
  }
  cout << sa.size() << "\n";
  for (int c : sa) {
    cout << c << " ";
  }
  cout << "\n";
  cout << sb.size() << "\n";
  for (int c : sb) {
    cout << c << " ";
  }
  cout << "\n";
  return 0;
}
