#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, r;     cin >> n >> r;     if (r <= (n + 1) / 2) {       cout << (2 * r - 1) << endl;     } else {       r -= (n + 1) / 2;       cout << 2 * r << endl;     }     return 0;   }   