#include <bits/stdc++.h>
using namespace std;
int hashk[10];
int main() {
  long long n, k;
  cin >> n >> k;
  if (n % 2) {
    if (k + k - 1 > n) {
      long long temp = n / 2;
      long long center = n / 2;
      center++;
      long long jarak = k - center - 1;
      long long ans = k - (temp - jarak);
      cout << ans << endl;
    } else
      cout << k + k - 1 << endl;
  } else {
    long long temp = n / 2;
    temp--;
    long long center = n / 2;
    center++;
    if (k + k - 1 > n) {
      long long jarak = k - center;
      long long ans = k - (temp - jarak);
      cout << ans << endl;
    } else
      cout << k + k - 1 << endl;
  }
  return 0;
}
