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