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