#define _GLIBCXX_DEBUG #include #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main(){ int n,k; cin>>n>>k; if(n%2==0){ (k>n/2?k=n/2:k+=0); cout<<(k==n/2?k:(k%2==0?k+1:k-1)); } else{ (k>n/2?k=n/2+1:k+=0); cout<<(k%2==0?2*k+1:2*(k-1)); } }