#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, k;
  cin >> n >> k;
  if (n % 2 == 0 and k <= n / 2) {
    cout << 2 * k - 1;
  } else if (n % 2 == 0 and k > n / 2) {
    k -= n / 2;
    cout << 2 * k;
  } else if (n % 2 != 0 and k <= (n / 2 + 1)) {
    cout << 2 * k - 1;
  } else if (n % 2 != 0 and k > (n / 2 + 1)) {
    cout << 2 * (k - 1 - n / 2);
  }
  return 0;
}
