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