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