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