#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
int main() {
  bool konsp[N] = {};
  bool konsp2[N] = {};
  int a, b;
  cin >> a >> b;
  queue<int> q1;
  queue<int> q2;
  int sum1 = 0;
  int i = 1;
  while (sum1 < a) {
    if (sum1 + i <= a) {
      sum1 += i;
      konsp[i] = true;
    } else {
      int k = a - sum1;
      int j = 1;
      while (true) {
        if (!konsp[j + k]) {
          konsp[j + k] = true;
          konsp[j] = false;
          sum1 += k;
          break;
        }
        j++;
      }
    }
    i++;
  }
  for (i = 0; i < N; i++)
    if (konsp[i]) q1.push(i);
  for (i = 0; i < N; i++) konsp2[i] = konsp[i];
  int sum2 = 0;
  i = 1;
  while (sum2 < b) {
    if (sum2 + i <= b && !konsp[i]) {
      sum2 += i;
      konsp2[i] = true;
    } else if (sum2 + i > b) {
      int k = b - sum2;
      int j = 1;
      while (true) {
        if (!konsp[j + k]) {
          if (sum2 + j + k <= b) {
            konsp2[j + k] = true;
            konsp2[j] = false;
            sum2 += k;
          } else
            sum2 = b;
          break;
        }
        j++;
      }
    }
    i++;
  }
  for (int i = 0; i < N; i++)
    if (konsp[i]) konsp2[i] = false;
  for (int i = 0; i < N; i++)
    if (konsp2[i]) q2.push(i);
  cout << q1.size() << endl;
  while (!q1.empty()) {
    cout << q1.front() << " ";
    q1.pop();
  }
  cout << endl;
  cout << q2.size() << endl;
  while (!q2.empty()) {
    cout << q2.front() << " ";
    q2.pop();
  }
  return 0;
}
