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