#include <bits/stdc++.h>
using namespace std;
long long power(long long base, int exponent) {
  long long ans = 1;
  while (exponent > 0) {
    if (exponent & 1) ans = (ans * base);
    exponent >>= 1;
    base = base * base;
  }
  return ans;
}
long long power(long long base, int exponent, int p) {
  long long ans = 1;
  base = base % p;
  while (exponent > 0) {
    if (exponent & 1) ans = (ans * base) % p;
    exponent >>= 1;
    base = (base * base) % p;
  }
  return ans;
}
int modInverse(int n, int p) { return power(n, p - 2, p); }
void factorialCalc(vector<int> &factorial, int n) {
  if (factorial.size() != n + 1) {
    factorial.resize(n + 1);
  }
  factorial[0] = 1;
  factorial[1] = 1;
  for (int i = 2; i <= n; i++) {
    factorial[i] = factorial[i - 1] * i;
  }
}
void factorialCalc(vector<int> &factorial, int n, int p) {
  if (factorial.size() != n + 1) {
    factorial.resize(n + 1);
  }
  factorial[0] = 1;
  factorial[1] = 1;
  for (int i = 2; i <= n; i++) {
    factorial[i] = (factorial[i - 1] * 1ll * i) % (p);
  }
}
unsigned long long nCr(unsigned long long n, int r, int p, vector<int> &fac) {
  if (r == 0) return 1;
  return (1ll * fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) %
          p) %
         p;
}
template <typename T>
void keySort(vector<T> &arr, vector<int> &key) {
  int n = arr.size();
  if (key.size() != n) {
    throw runtime_error("Size of data array not equals to size of key array");
  }
  vector<T> ans(n);
  int ar[n];
  for (int i = 0; i < n; i++) {
    ar[key[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    ans[i] = arr[ar[i]];
  }
  arr = ans;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
  os << '(' << p.first << ',' << p.second << ')';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> p) {
  os << "{ ";
  for (auto i : p) {
    os << i << ",";
  }
  os << "\b";
  os << "}";
  return os;
}
template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
  in >> p.first >> p.second;
  return in;
}
void solve();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
int quadratic(long long a, long long b, long long c) {
  assert(b * b - 4 * a * c >= 0);
  return (-b + sqrt(b * b - 4 * a * c)) / (2 * a);
}
void solve() {
  int a, b;
  cin >> a >> b;
  int na = 0, nb = 0;
  vector<int> aa, bb;
  int val = quadratic(1, 1, -2ll * (0ll + a + b));
  for (int i = val; i > 0; i--) {
    if (na + i <= a) {
      na += i;
      aa.push_back(i);
    } else if (nb + i <= b) {
      nb += i;
      bb.push_back(i);
    }
  }
  cout << aa.size() << endl;
  for (auto i : aa) {
    cout << i << ' ';
  }
  cout << endl;
  cout << bb.size() << endl;
  for (auto i : bb) {
    cout << i << ' ';
  }
  cout << endl;
}
