#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long a, b, maxNum, sum, n1;
bool check[1000005];
int main() {
  cin >> a >> b;
  while (sum <= a + b) sum += maxNum, ++maxNum;
  sum = maxNum = maxNum - 2;
  long long d = maxNum;
  for (int i = maxNum; i >= 1 && a != 0; --i) {
    if (maxNum >= a && a != 0)
      maxNum = a, ++n1, check[a] = 1, a = 0;
    else
      ++n1, a -= maxNum, check[maxNum] = 1, --maxNum;
  }
  cout << n1 << endl;
  for (int i = 1; i <= d; ++i)
    if (check[i]) cout << i << " ";
  cout << endl << d - n1 << endl;
  for (int i = 1; i <= d; ++i)
    if (!check[i]) cout << i << " ";
  return 0;
}
