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