#include <bits/stdc++.h>
using namespace std;
vector<long long> v1[1000100];
vector<long long> v2;
map<long long, long long> m1;
map<long long, long long> m2;
map<long long, long long> m3;
map<char, long long> ms1;
map<string, long long> ms2;
stack<long long> sta;
long long big = 999999999999999999, small = -999999999999999999;
long long z, y, x, n, m, i, j, k, t, l, ans, sum1, sum2, avg, test, b[500100],
    c[500100], a[500100], d[500100], co1[100100], co2[100100];
char s[1000100], s1[1000100], s2[1000100], temp;
bool pro[1000100], pro1, pro2, pro3;
int main() {
  cin >> n >> k;
  k > (n + 1) / 2 ? cout << 2 * (k - (n + 1) / 2) : cout << 2 * k - 1;
  return 0;
}
