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