#include <bits/stdc++.h>
int main() {
  signed long long n, k;
  scanf("%llu %llu", &n, &k);
  if (k > n - n / 2)
    printf("%lld", (k - (n - n / 2)) * 2);
  else
    printf("%lld", 1 + (k - 1) * 2);
  return 0;
}
