#include <iostream>
#include <cmath>
using namespace std;
int main (){
int k,n;
cin >> n >>k;
if( ceil((double)n/2) < k){
cout << (k- ceil((double)n/2))* 2;
}
else cout << k*2 -1;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluICgpewogICAgaW50IGssbjsKICAgIGNpbiA+PiBuID4+azsKICAgIGlmKCBjZWlsKChkb3VibGUpbi8yKSA8IGspewogICAgICAgIGNvdXQgPDwgKGstIGNlaWwoKGRvdWJsZSluLzIpKSogMjsKICAgIH0KICAgIGVsc2UgY291dCA8PCBrKjIgLTE7CiAgICByZXR1cm4gMDsKfQ==