#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  bool flag = false;
  long long int a = pow(2 * (n + m), 0.5) + 3;
  if (n > m) {
    swap(n, m);
    flag = true;
  }
  long long int b = pow(2 * n, 0.5) + 3;
  long long int ans = 0, ans1 = 0;
  for (long long int i = a; i >= 1; i--) {
    if (i * (i + 1) / 2 <= n + m) {
      ans = i;
      break;
    }
  }
  for (long long int i = b; i >= 1; i--) {
    if (i * (i + 1) / 2 <= n) {
      ans1 = i;
      break;
    }
  }
  bool arr1[ans + 1], arr[ans + 1];
  for (long long int i = 0; i <= ans; i++) {
    arr[i] = false;
  }
  for (long long int i = 0; i <= ans; i++) arr1[i] = false;
  long long int sum = 0;
  for (long long int i = ans; i >= 1; i--) {
    if (sum + i > n) {
      continue;
    } else {
      sum += i;
      arr1[i] = true;
    }
  }
  for (long long int i = 1; i <= ans; i++) {
    if (arr1[i] == false) arr[i] = true;
  }
  int count1 = 0, count = 0;
  for (long long int i = 1; i <= ans; i++)
    if (arr1[i] == true) count1++;
  for (long long int i = 1; i <= ans; i++)
    if (arr[i] == true) count++;
  if (flag == false) {
    cout << count1 << "\n";
    for (long long int i = 0; i <= ans; i++)
      if (arr1[i] == true) cout << i << " ";
    if (count1 != 0) cout << "\n";
    cout << count << "\n";
    for (long long int i = 0; i <= ans; i++)
      if (arr[i] == true) cout << i << " ";
  } else {
    cout << count << "\n";
    for (long long int i = 0; i <= ans; i++)
      if (arr[i] == true) cout << i << " ";
    if (count != 0) cout << "\n";
    cout << count1 << "\n";
    for (long long int i = 0; i <= ans; i++)
      if (arr1[i] == true) cout << i << " ";
  }
}
