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