#include <bits/stdc++.h>
using namespace std;
const int N = 90010;
int a, b;
bool pred(int x) {
  long long sum = x * (long long)(x + 1) / 2;
  int ra = a;
  for (int i = x; i; --i) {
    if (ra >= i) {
      ra -= i;
      sum -= i;
    }
  }
  return sum <= b;
}
int main() {
  scanf("%d%d", &a, &b);
  int l = 0, r = N - 1;
  while (l < r) {
    int mid = (l + r + 1) / 2;
    if (pred(mid))
      l = mid;
    else
      r = mid - 1;
  }
  vector<int> va, vb;
  long long sum = l * (long long)(l + 1) / 2;
  int ra = a;
  for (int i = l; i; --i) {
    if (ra >= i) {
      ra -= i;
      sum -= i;
      va.push_back(i);
    } else
      vb.push_back(i);
  }
  printf("%lu\n", va.size());
  for (int x : va) printf("%d ", x);
  putchar('\n');
  printf("%lu\n", vb.size());
  for (int x : vb) printf("%d ", x);
  putchar('\n');
  return 0;
}
