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