#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define d(x) cout<<x<<" "
#define nl cout<<endl
#define rep(var,init_val,final_val) for(int var = init_val; var < final_val; ++var)
#define show(a,b) rep(i,0,b) d(a[i]);nl;
#define showv(a) for(auto x : a) d(x);nl;
#define vi std::vector<int>
#define pi pair<int,int>
#define mod 1000000007
void solve(){
	int a , b;
	cin>>a>>b;
	vi ans;
	if(a>b){
		int sum = 0;
		rep(i,1,a+1){
			ans.pb(i);
			sum+=i;
		}
		rep(i,1,b){
			ans.pb(-i);
			sum-=i;
			}
		ans.pb(-sum);
		}
	else{
		int sum = 0;
		rep(i,1,b+1){
			ans.pb(-i);
			sum+=i;
		}
		rep(i,1,a){
			ans.pb(i);
			sum-=i;
			}
		ans.pb(sum);
	}
	showv(ans);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int t = 1;
	//cin>>t;
	while(t--)
		solve();
    return 0;
	}

#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    if (fopen("input.in", "r")) 
        freopen("input.in", "r", stdin), freopen("output.out", "w", stdout);
    int n;
    cin>>n;
    vector<int> a(n); for(int& i : a) cin>>i, i--;
    vector<int> loc(n);
    for(int i = 0; i < n; i++) loc[a[i]] = i;
    vector<int> ans;
    vector<bool> used(n-1, 0);
    bool bad = 0;
    for(int i = 0; i < n; i++) {
        if(loc[i] != i){
            assert(loc[i] > i);
            for(int k = loc[i]-1; k>=i; k--){
                if(used[k]) {
                    bad = 1; goto done; 
                }
                used[k] = 1;
                ans.push_back(k); 
                loc[a[k]]++;
                loc[a[k+1]]--;
                swap(a[k], a[k+1]);
                assert(loc[a[k+1]]==k+1 && loc[a[k]]==k);
            }
        }
        assert(loc[i] == i);
    }
    done:;
    if(ans.size()!=n-1) bad=1;
    if(bad) cout<<-1<<'\n';
    else for(int i : ans) cout<<i+1<<'\n';

    
}
