#include <bits/stdc++.h>
using namespace std;
const int maxn = 100007;
const int inf = (1LL << 29);
vector<int> g;
map<int, int> aa;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a = n + m;
  long long pos = 0;
  while ((pos + 1) * (pos + 2) / 2 <= a) pos++;
  if (n < m) {
    long long now = pos;
    while (n) {
      long long x;
      n -= (x = min(now, n));
      now--;
      aa[x] = 1;
      g.push_back(x);
    }
    printf("%d\n", g.size());
    for (int i = 0; i < g.size(); i++) printf("%d ", g[i]);
    printf("\n");
    printf("%d\n", pos - g.size());
    for (int i = 1; i <= pos; i++) {
      if (!aa[i]) printf("%d ", i);
    }
  } else {
    long long now = pos;
    while (m) {
      long long x;
      m -= (x = min(now, m));
      now--;
      aa[x] = 1;
      g.push_back(x);
    }
    printf("%d\n", pos - g.size());
    for (int i = 1; i <= pos; i++) {
      if (!aa[i]) printf("%d ", i);
    }
    printf("\n");
    printf("%d\n", g.size());
    for (int i = 0; i < g.size(); i++) {
      printf("%d ", g[i]);
    }
  }
  return 0;
}
