#include using namespace std; typedef long long ll; typedef pair l_l; typedef pair i_i; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } const long long INF = 1e18; //const ll mod = 1000000007; int main() { cin.tie(0); ios::sync_with_stdio(false); ll a, b; cin >> a >> b; ll maxi = 0; chmax(maxi, b - a - 1); chmax(maxi, a - b- 1); cout << a + b - 1 - maxi << endl; return 0; }