#include <bits/stdc++.h>
using namespace std;

int a[1000006];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);     cout.tie(0);
    freopen("CHONGOI.INP","r",stdin);
    freopen("CHONGOI.OUT","w",stdout);
    int n,k;
    cin >> n>>k;
    int i=n/2, j=i+1;
    a[i]=1; a[j]=2;
    i--; j++;
    while (i>=1)
    {
        if (a[i+1] % 2==0)
        {
            a[i]=a[i+1]+1;
            a[j]=a[j-1]+3;
        }
        else
        {
            a[i]=a[i+1]+3;
            a[j]=a[j-1]+1;
        }
        i--;
        j++;
    }
    //for (int i=1; i<=n; i++) cout<<a[i] << ' ';
    //cout<<endl;
    for (int i=1; i<=n; i++)
        if (a[i]==k)
        {
            cout<<i;
            break;
        }
    return 0;
}
