#include <iostream>
#include <vector>
#include <set>
using namespace std;
using pairint = pair<int, int>;

int main(void){
    int N, M, Abuf, Bbuf;
    vector<int> dp;
    vector<vector<int>> cgroups;
    vector<pairint> upperbits;
    vector<int> birank;
    cin >> N >> M;
    int numid = 1<<N;
    upperbits.assign(numid, pairint(0, 0));
    birank.assign(numid, 0);
    cgroups.assign(N, {});
    for(int i=0; i<N; i++)upperbits[1<<i].first=i;
    for(int i=1; i<numid; i++){
        if(upperbits[i].first==0)upperbits[i].first=upperbits[i-1].first;
        upperbits[i].second=upperbits[i-(1<<upperbits[i].first)].first;
        birank[i]=birank[i-(1<<upperbits[i].first)]+1;
    }
    dp.assign(numid, 0);
    for(int i=1; i<numid; i<<=1){
        dp[i]=1;
        for(int j=i<<1; j<numid; j<<=1)dp[i+j]=2;
    }
    for(int i=0; i<M; i++){
        cin >> Abuf >> Bbuf;
        Abuf--;
        Bbuf--;
        int id = (1<<Abuf)+(1<<Bbuf);
        dp[id]=1;
        cgroups[Bbuf].push_back(id);
    }
    for(int i=1; i<numid; i++){
        if(dp[(1<<upperbits[i].first)+(1<<upperbits[i].second)]!=1)continue;
        if(dp[i-(1<<upperbits[i].first)]!=1)continue;
        if(dp[i-(1<<upperbits[i].second)]!=1)continue;
        dp[i]=1;
        cgroups[upperbits[i].first].push_back(i);
    }
    for(int i=3; i<numid; i++){
        if(dp[i]==1)continue;
        int j = 1<<upperbits[i].first;
        if(dp[i-j]==1){
            dp[i]=2;
            continue;
        }
        bool dividable = false;
        for(int id: cgroups[upperbits[i].first]){
            int jd = id-j;
            if(jd != (i&jd))continue;
            int kd = i&(~id);
            if(dp[jd+kd] == dp[kd]+1){
                dp[i] = dp[kd]+1;
                dividable = true;
                break;
            }
        }
        if(!dividable)dp[i] = dp[i-j]+1;
    }
    cout << dp[numid-1] << endl;
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define loop(i,n) for(ll i=0;i<n;i++)
#define loop1(i,n) for(ll i=1;i<=n;i++)
#define fast_az_fck ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
//template<class T, class H>using umap=unordered_map<T,H,custom_hash>;
void init_code()
{
    fast_az_fck
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
}

int main()
{
    init_code();
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll a,b;cin>>a>>b;
        if(a>=b)
        {
            ll sum1=(a*(a+1))/2;
            ll sum2=-sum1;
            ll sum3=-((b*(b-1))/2);
            for(ll i=1;i<=a;i++)
            {
                cout<<i<<" ";
            }
            for(ll i=-1;i>-b;i--)
            {
                cout<<i<<" ";
            }
            cout<<(sum2-sum3);
        }
        else
        {
            ll sum1=-((b*(b+1))/2);
            ll sum2=-sum1;
            ll sum3=((a*(a-1))/2);
            for(ll i=-1;i>=-b;i--)
            {
                cout<<i<<" ";
            }
            for(ll i=1;i<a;i++)
            {
                cout<<i<<" ";
            }
            cout<<(sum2-sum3);
        }
    }
} 
