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