#include <bits/stdc++.h>
using namespace std;
void file() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void _print(long long t) { cerr << t; }
void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(long double t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(unsigned long long t) { cerr << t; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(multiset<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
long long n, m, i, j, x;
char ch;
string str;
map<long long, long long>::iterator it;
set<long long>::iterator ist;
void solve() {
  cin >> n >> m;
  bool flip = 0;
  if (m > n) {
    flip = 1;
    swap(n, m);
  }
  long long sum = 0, cnt = 0;
  vector<long long> vis;
  vis.push_back(0);
  for (long long i = 1; sum + i <= n + m; i++) {
    sum += i;
    vis.push_back(1);
    j = i;
    cnt++;
  };
  vector<long long> v;
  for (; j >= 1; j--) {
    if (j > m) continue;
    if (!vis[j]) continue;
    vis[j] = 0;
    m -= j;
    v.push_back(j);
  };
  ;
  if (flip) {
    cout << v.size() << endl;
    for (long long x : v) cout << x << " ";
    cout << endl;
    cout << cnt - v.size() << endl;
    for (long long i = 1; i < vis.size(); i++) {
      if (vis[i]) cout << i << " ";
    }
    cout << endl;
  } else {
    cout << cnt - v.size() << endl;
    for (long long i = 1; i < vis.size(); i++) {
      if (vis[i]) cout << i << " ";
    }
    cout << endl;
    cout << v.size() << endl;
    for (long long x : v) cout << x << " ";
    cout << endl;
  }
}
signed main() {
  file();
  long long test = 1;
  while (test--) {
    solve();
  }
}
