#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
  LL N, K;
  scanf("%lld %lld", &N, &K);
  if (N % 2 == 0) {
    if (K <= N / 2)
      printf("%lld\n", 2 * K - 1);
    else
      printf("%lld\n", 2 * K - N);
  } else {
    if (K > (N + 1) / 2)
      printf("%lld\n", 2 * K - N - 1);
    else
      printf("%lld\n", 2 * K - 1);
  }
  return 0;
}
