#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int a,b;cin >> a >> b;
	cout << (a > b ? 2*a-1 : b > a ? 2*b -1 : 2*a);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,s, n) for(int i = s; i < (int)(n); i++)
#define co(x) cout<<x<<endl
#define SQvec(i,j) vector<vector<int>> data(i, vector<int>(j))
#define mod 1000000007
typedef long long int lint;

int main() {
  int N,K;
  cin >> N >> K;
  if(N%K == 0){co(0);}
  else{co(1);}
  
  return 0;
}