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