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