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