#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

int main()
{
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);


    ll B, C;
    cin >> B >> C;

    ll ans = 0;
    bool flag = false;

    if (B) {
        if (B < 0) {
            flag = true;
        }
        B = abs(B);
        if (C >= 2 * B) {
            ans = 2 * B + C - 1;
            if (flag)
                ans++;
        } else {
            ans = C + (C > 2 ? C - 1 : 1);
        }
    } else {
        ans = (C >= 2 ? C : 1);
    }
    /*    if (C % 2) {
        ans = 1 + (C - 1) * (C + 1) / 4 + (C + 1) / 2;
    } else {
        ans = 1 + C * (C + 2) / 2;
    }
    */
    cout << ans << endl;
}

/**
 *    author:  yixxas
 *    created: 19.12.2020 19:56:03
**/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cassert>

using namespace std;

int main(){

    int a,b;
    cin >> a>> b;
    cout << a/b;

    return 0;
}


//What we know is a drop, what we don't is an ocean.

