#include <bits/stdc++.h>
using namespace std;
long long int justgreater(long long int n) {
  long long int i;
  for (i = 1;; i++)
    if (i * (i + 1) / 2 > n) break;
  return i - 1;
}
int main() {
  long long int m, n, a[100009] = {0}, sum = 0, cnt = 0;
  cin >> m >> n;
  long long int up = justgreater(m + n);
  long long int tup = up;
  for (; tup >= 1; tup--) {
    if (sum + tup > m) continue;
    sum += tup;
    a[tup]++;
  }
  long long int cnt0 = 0, cnt1 = 0;
  for (long long int i = 1; i <= up; i++)
    if (a[i] == 1)
      cnt0++;
    else
      cnt1++;
  cout << cnt0 << endl;
  for (long long int i = 1; i <= up; i++)
    if (a[i] == 1) cout << i << " ";
  cout << endl;
  cout << cnt1 << endl;
  for (long long int i = 1; i <= up; i++)
    if (a[i] == 0) cout << i << " ";
  return 0;
}
