#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int l = 1;
  int r = 100000;
  while (r - l > 1) {
    int m = (l + r) / 2;
    vector<bool> used(m + 1);
    int A = a;
    int B = b;
    int cnt = 0;
    for (int i = m; i >= 1; i--) {
      if (A >= i) {
        A -= i;
        used[i] = true;
        cnt++;
      }
    }
    for (int i = m; i >= 1; i--) {
      if (B >= i && !used[i]) {
        B -= i;
        cnt++;
      }
    }
    if (cnt == m) {
      l = m;
    } else {
      r = m;
    }
  }
  {
    vector<bool> used(l + 1);
    int A = a;
    int B = b;
    vector<int> ansA, ansB;
    for (int i = l; i >= 1; i--) {
      if (A >= i) {
        A -= i;
        used[i] = true;
        ansA.push_back(i);
      }
    }
    for (int i = l; i >= 1; i--) {
      if (B >= i && !used[i]) {
        B -= i;
        ansB.push_back(i);
      }
    }
    cout << ansA.size() << endl;
    for (int i = 0; i < ansA.size(); i++) {
      if (i > 0) putchar(' ');
      printf("%d", ansA[i]);
    }
    putchar('\n');
    cout << ansB.size() << endl;
    for (int i = 0; i < ansB.size(); i++) {
      if (i > 0) putchar(' ');
      printf("%d", ansB[i]);
    }
    putchar('\n');
  }
}
