#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(x) (x).erase(unique(ALL(x)), (x).end())
#define TOUPPER(x) transform(ALL(x), (x).begin(), ::toupper)
#define TOLOWER(x) transform(ALL(x), (x).begin(), ::tolower)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
ll qp(ll a, ll b){ll ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
ll qp(ll a, ll b, ll mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a, int b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll INFL = 1e18;
const int MOD = 1e9 + 7;

int main(){
    int A, B;
    cin >> A >> B;
    vector<int> EA(A,0), EB(B,0);
    rep(i,min(A,B)) {
        EA[i] = EB[i] = i+1;
    }
    if(A > B) {
        int idx = 0;
        rep(i,A-B) {
            EA[B+i] = EA[B+i-1]+1;
            rep(j,EA[B+i]) {
                ++EB[(B-1-(idx++))%B];
                idx %= B;
            }
        }
    } else if(A < B) {
        int idx = 0;
        rep(i,B-A) {
            EB[A+i] = EB[A+i-1]+1;
            rep(j,EB[A+i]) {
                ++EA[(A-1-(idx++))%A];
                idx %= A;
            }
        }
    }
    rep(i,A+B) {
        cout << (i < A ? EA[i] : -EB[i-A]) << (i == A+B-1 ? "\n" : " ");
    }
    return 0;
}

#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>   // popen, pclose, fgets
#include <cstdlib> 
using namespace std;
#define rep0(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>;
using ll = long long; //long longをllだけにした
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll =vector<vvll>;
const double PI=3.14159265358979323846;
//小数点以下を指定したい時　　→→→→  cout << fixed << setprecision();
//int→string　　string str = to_string(num);
//string→int   int num = atoi(numStr.c_str());

int main() {
    int a,b;cin>>a>>b;
    int ans=0;
    if(a+b>=15 && b>=8){
        ans=1;
    }
    else if(a+b>=10&&b>=3){
        ans=2;
    }
    else if(a+b>=3){
        ans=3;
    }
    else{
        ans=4;
    }
    cout<<ans<<endl;
}