#include <bits/stdc++.h>
using namespace std;
long long n, m, T, k, d;
const long long big = 1000000007;
vector<int> ANS1, ANS2;
bool mark[4000000] = {0};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long a, b, c, d, e;
  cin >> a >> b;
  long long sum = 0;
  for (int c1 = 1; c1 < 100000000; c1++) {
    sum += c1;
    if (sum > a + b) {
      sum -= c1;
      k = c1 - 1;
      break;
    }
  }
  for (int c1 = k; c1 >= 1; c1--) {
    if (c1 <= a) {
      ANS1.push_back(c1);
      a -= c1;
      mark[c1] = 1;
    }
  }
  for (int c1 = 1; c1 <= k; c1++) {
    if (!mark[c1]) ANS2.push_back(c1);
  }
  cout << (int)(ANS1).size() << "\n";
  for (int c1 = 0; c1 < (int)(ANS1).size(); c1++) {
    cout << ANS1[c1] << " ";
  }
  cout << "\n";
  cout << (int)(ANS2).size() << "\n";
  for (int c1 = 0; c1 < (int)(ANS2).size(); c1++) {
    cout << ANS2[c1] << " ";
  }
  cout << "\n";
  return 0;
}
