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