#include <bits/stdc++.h>
const int mo = 1000000007;
const int inf = 0x3f3f3f3f;
double pi = 3.14159265358979323846;
double e = 2.71828182845904523536;
using namespace std;
void read(int &x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' && ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
vector<int> v;
vector<int>::iterator it;
int main() {
  long long n, m;
  cin >> n >> m;
  long long sum = 2 * (n + m);
  long long x = (sqrt(1 + 4 * sum) - 1) / 2;
  for (int i = 1; i <= x; i++) v.push_back(i);
  long long nn = n;
  stack<int> s;
  while (nn) {
    it = lower_bound(v.begin(), v.end(), nn);
    if (it == v.end()) it--;
    if ((*it) > nn) it--;
    s.push(*it);
    nn -= (*it);
    v.erase(it);
    if (it == v.begin()) break;
  }
  cout << s.size() << endl;
  while (!s.empty()) {
    cout << s.top() << ' ';
    s.pop();
  }
  cout << endl;
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) cout << v[i] << ' ';
  cout << endl;
  return 0;
}
