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