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