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