#include <bits/stdc++.h>
using namespace std;
int main(void) {
  unsigned long long n = 0, k = 0;
  cin >> n >> k;
  unsigned long long second_ix = n / 2;
  if (n % 2 == 1) {
    second_ix++;
  }
  unsigned long long result = 0;
  if (k <= second_ix) {
    result = (k * 2) - 1;
  } else {
    result = (k - second_ix) * 2;
  }
  cout << result;
  return 0;
}
