#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
namespace sxdaknoip {
long long a, b;
inline bool pan(long long k) {
  long long ta = a, tb = b;
  for (long long i = k; i; --i) {
    if (i <= ta)
      ta -= i;
    else if (i <= tb)
      tb -= i;
    else
      return false;
  }
  return true;
}
vector<long long> ans[2];
int main() {
  scanf("%lld%lld", &a, &b);
  long long l = 1, r = 1000000;
  while (l < r - 1) {
    int mid = (l + r) >> 1;
    if (pan(mid))
      l = mid;
    else
      r = mid - 1;
  }
  if (!pan(r)) r--;
  long long ta = a, tb = b;
  for (long long i = r; i; --i) {
    if (i <= ta) {
      ta -= i;
      ans[0].push_back(i);
    } else if (i <= tb) {
      tb -= i;
      ans[1].push_back(i);
    }
  }
  printf("%d\n", (int)ans[0].size());
  for (int i = ans[0].size() - 1; ~i; --i) printf("%lld ", ans[0][i]);
  puts("");
  printf("%d\n", (int)ans[1].size());
  for (int i = ans[1].size() - 1; ~i; --i) printf("%lld ", ans[1][i]);
  puts("");
  return 0;
}
}  // namespace sxdaknoip
int main() {
  sxdaknoip::main();
  return 0;
}
