#include<bits/stdc++.h>

using namespace std;


int mx=200005;

bool prime[200005];
vector <int> vec;

void normal_sieve(int n)
{
    int i, N=sqrt(n), p;

    memset(prime, 1, sizeof(prime));

    for(p=3; p<=N; p+=2)
    {
        if(prime[p]==1)
        {
            for(i=p*p; i<=n; i+=p)
            {
                prime[i]=0;
            }
        }
    }
    vec.push_back(2);
    for(i=3; i<200001; i+=2)
    {
        if(prime[i] == 1)
            vec.push_back(i);
    }
}

int main()
{
    int a,b;
    cin >> a >> b;
    int mx = 0;
    int dif = b-a;
    for(int i=dif; i>=0; i--)
    {
        int low = ceil(a*1.0/i);
        int high = floor(b*1.0/i);
        if(low*i >= a && low*i<=b && high*i>=a && high*i<=b && low!=high)
        {
            mx = i;
            break;
        }
    }
    cout << mx << endl;
    return 0;
}

#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
#include <iomanip>
#include <cmath>
#include <set>
#include <unordered_set>
#include <functional>
#include <map>
#include <unordered_map>
#include <string>
#include <tuple>
using namespace std;
using ll = long long;
const int MOD=1e9+7;
const int MAX=100009;
ll fac[100009],finv[100009],inv[100009];

#define pi 3.14159265358979323846
#define ee 2.71828182845904523536
#define INF 1e18+1

ll gcd(ll x, ll y) { // 最大公約数
    if (y == 0)return x;
    else return gcd(y, x % y);
}

bool prime(ll x) { //素数判定
    if(x==1)return false;
    if (x!=2&&x % 2 == 0)return false;
    for (ll i = 3; i <= sqrt(x); i+=2) {
        if (x % i == 0)return false;
    }
    return true;
}

ll modinv(ll a, ll m) { //逆元
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modpow(ll a, ll n, ll mod) { //二分累乗法
    ll res = 1;
    while (n) {
        if (n % 2)res = res * a % mod;
        a = a * a % mod;
        n /= 2;
    }
    return res;
}

void COMinit() { //二項係数計算の前処理
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(int n, int k){ //二項係数計算
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct UnionFind {   // UnionFind
    vector<int> par;
    vector<int> siz;

    UnionFind(int N) : par(N), siz(N, 1) {
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (par[rx] > par[ry])swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    int size(int x) {
        return siz[root(x)];
    }
};

int main() {
    int a,b;
    cin>>a>>b;
    if(a>b){
        for(int i=0;i<a;i++){
            cout<<i+1<<" ";
        }
        int sum=a*(a+1)/2;   
        for(int i=0;i<b-1;i++){
            cout<<-(i+1)<<" ";
            sum-=(i+1);
        }
        cout<<-sum<<endl;
    }
    else{
        for(int i=0;i<b;i++){
            cout<<-(i+1)<<endl;
        }
        int sum=b*(b+1)/2;
        for(int i=0;i<a-1;i++){
            cout<<i+1<<" ";
            sum-=(i+1);
        }
        cout<<sum<<endl;
    }
}   