#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> a1, a2;
int vis[100020];
signed main() {
  scanf("%d%d", &n, &m);
  long long tot = n + m, ans = 0;
  while (ans * (ans + 1) / 2 <= tot) ans++;
  ans--;
  for (int p = ans; n > 0 && p > 0; --p) {
    if (n >= p) {
      n -= p, vis[p] = 1, a1.push_back(p);
    } else if (n < p) {
      a1.push_back(n);
      vis[n] = 1;
      n = 0;
      break;
    }
  }
  for (int i = 1; i <= ans; ++i)
    if (!vis[i]) a2.push_back(i);
  int sz1 = a1.size(), sz2 = a2.size();
  cout << a1.size() << '\n';
  for (int i = 0; i < sz1; ++i) printf("%d%c", a1[i], " \n"[i == sz1 - 1]);
  cout << a2.size() << '\n';
  for (int i = 0; i < sz2; ++i) printf("%d%c", a2[i], " \n"[i == sz2 - 1]);
  return 0;
}
