#include <bits/stdc++.h>
using namespace std;
int a, b;
set<int> wor;
int main() {
  scanf("%d %d", &a, &b);
  int n = 0;
  int m = 0;
  int x = 1;
  while (a >= x) {
    a -= x;
    x++;
    n++;
  }
  int y;
  if (n > 0)
    y = (a / n);
  else
    y = 0;
  if (n > 0) a %= n;
  vector<int> tab, tabb;
  for (int i = 1; i < x; i++) tab.push_back(i + y);
  for (int i = n - 1; i >= 0; i--)
    if (a > 0) {
      tab[i]++;
      a--;
    }
  for (int i = 0; i < (int)tab.size(); i++) wor.insert(tab[i]);
  x = 1;
  while (x <= b) {
    if (wor.count(x) == 0) {
      m++;
      b -= x;
      tabb.push_back(x);
    }
    x++;
  }
  printf("%d\n", n);
  for (auto w : wor) printf("%d ", w);
  printf("\n%d\n", m);
  for (int i = 0; i < m; i++) printf("%d ", tabb[i]);
  printf("\n");
}
