#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
vector<int> v1, v2;
int flag[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int now = 0, cc;
  for (cc = 1;;) {
    now += cc;
    if (now > n + m) break;
    cc++;
  }
  cc--;
  for (int i = (cc + 1) - 1; i >= (1); --i)
    if (n >= i) v1.push_back(i), n -= i, flag[i] = 1;
  for (int i = (cc + 1) - 1; i >= (1); --i)
    if (!flag[i]) v2.push_back(i);
  printf("%d\n", ((int)(v1).size()));
  for (int i = (0); i < (((int)(v1).size())); ++i)
    printf("%d%c", v1[i], " \n"[i == ((int)(v1).size()) - 1]);
  printf("%d\n", ((int)(v2).size()));
  for (int i = (0); i < (((int)(v2).size())); ++i)
    printf("%d%c", v2[i], " \n"[i == ((int)(v2).size()) - 1]);
  return 0;
}
