#include <bits/stdc++.h>
using namespace std;
long long int expo_fast(long long int a, long long int b) {
  a = a;
  long long int result = 1;
  while (b) {
    if (b & 1) result = (result * a);
    b >>= 1;
    a = (a * a);
  }
  return (result);
}
void take_in(vector<long long int>* arr) {
  for (int i = 0; i < arr->size(); i++) cin >> (*(arr))[i];
}
void disp_arr(vector<long long int>* arr) {
  for (int i = 0; i < arr->size(); i++) cout << (*(arr))[i] << " ";
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int a, b;
  cin >> a >> b;
  long long int c = a + b;
  long long int lb = 0, ub = c;
  long long int ans = -1;
  while (lb <= ub) {
    long long int mid = (lb + ub) / 2;
    if ((((mid * (mid + 1)) / 2) <= c)) {
      ans = mid;
      lb = mid + 1;
    } else
      ub = mid - 1;
  }
  vector<long long int> ans1, ans2, visited(ans + 1);
  long long int temp = ans;
  while (a >= temp && temp > 0) {
    ans1.push_back(temp);
    visited[temp] = 1;
    a -= temp;
    temp--;
  }
  if (a != 0 && visited[a] == 0) ans1.push_back(a);
  visited[a] = 1;
  for (int i = 1; i <= ans; i++) {
    if (!visited[i]) ans2.push_back(i);
  }
  cout << ans1.size();
  cout << "\n";
  for (long long int x : ans1) cout << x << " ";
  cout << "\n";
  cout << ans2.size();
  cout << "\n";
  for (long long int x : ans2) cout << x << " ";
  cout << "\n";
}
