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