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