#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  while (~scanf("%lld%lld", &n, &k)) {
    long long n2 = n >> 1;
    if (n & 1) ++n2;
    if (k <= n2) {
      printf("%lld\n", (k << 1) - 1ll);
    } else {
      printf("%lld\n", (k - n2) << 1);
    }
  }
  return 0;
}
