Being a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural number is positive integer number). He is determined to rearrange them. But there are too many natural numbers, so Volodya decided to start with the first n. He writes down the following sequence of numbers: firstly all odd integers from 1 to n (in ascending order), then all even integers from 1 to n (also in ascending order). Help our hero to find out which number will stand at the position number k.


-----Input-----

The only line of input contains integers n and k (1 ≤ k ≤ n ≤ 10^12).

Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.


-----Output-----

Print the number that will stand at the position number k after Volodya's manipulations.


-----Examples-----
Input
10 3

Output
5
Input
7 7

Output
6


-----Note-----

In the first sample Volodya's sequence will look like this: {1, 3, 5, 7, 9, 2, 4, 6, 8, 10}. The third place in the sequence is therefore occupied by the number 5.

Source: codeforces | Difficulty: EASY
Tags: Mathematics


Solutions:
(n, k) = map(int, input().split())
(odd, even) = ((n + 1) // 2, n // 2)
if k <= odd:
	print(int(k * 2) - 1)
else:
	print(int((k - odd) * 2))


a = input().split()
n = int(a[0])
k = int(a[1])
x = n // 2 + n % 2
if k <= x:
	print(k * 2 - 1)
else:
	print((k - x) * 2)


import math
numbers = [int(i) for i in input().split()]
n = numbers[0]
k = numbers[1]
if k <= math.ceil(n / 2):
	print(2 * k - 1)
else:
	num_odds = math.ceil(n / 2)
	pos_even = k - num_odds
	print(2 * pos_even)


import math
(n, k) = [int(i) for i in input().split()]
if k > math.ceil(n / 2):
	num = (k - math.ceil(n / 2)) * 2
else:
	num = k * 2 - 1
print(num)


(x, y) = map(int, input().split())
if x % 2 == 1:
	if y > x // 2 + 1:
		print(2 * (y - (x // 2 + 1)))
	else:
		print(2 * y - 1)
elif y > x // 2:
	print(2 * (y - x // 2))
else:
	print(2 * y - 1)


(n, k) = list(map(int, input().split()))
numOdds = n // 2 if n % 2 == 0 else (n + 1) // 2
if k <= numOdds:
	print(k * 2 - 1)
else:
	evenPos = k - numOdds
	print(evenPos * 2)


(n, k) = map(int, input().split())
if n % 2 == 0:
	if k <= n // 2:
		print(k + (k - 1))
	else:
		print(k - (n - k))
elif k <= n // 2 + 1:
	print(k + (k - 1))
else:
	print(k - (n - k) - 1)


(a, b) = map(int, input().split())
if b > a // 2 + a % 2:
	print(2 + (b - (a // 2 + a % 2) - 1) * 2)
else:
	print(1 + (b - 1) * 2)


(num, pos) = list(map(int, input().split()))
if num % 2 == 0 and pos <= num / 2:
	answer = pos * 2 - 1
elif num % 2 == 0 and pos > num / 2:
	answer = (pos - num / 2) * 2
if num % 2 != 0 and pos <= num // 2 + 1:
	answer = pos * 2 - 1
elif num % 2 != 0 and pos > num // 2 + 1:
	pos = pos - (num // 2 + 1)
	answer = pos * 2
print(int(answer))


line = input()
line = line.split()
n = int(line[0])
p = int(line[1])
L = []
if n % 2 == 0:
	if p > n / 2:
		print(int(2 * (p - n / 2)))
	else:
		print(int(2 * p - 1))
elif p > (n + 1) / 2:
	print(int(2 * (p - (1 + n) / 2)))
else:
	print(int(2 * p - 1))


(n, k) = map(int, input().split())
odds = (n + 1) // 2
if k <= odds:
	print(k * 2 - 1)
else:
	print((k - odds) * 2)


(n, k) = map(int, input().split())
import math
if n % 2 == 0:
	if k <= n / 2:
		print(2 * k - 1)
	else:
		print(int(2 * (k - n / 2)))
elif k <= math.ceil(n / 2):
	print(2 * k - 1)
else:
	print(int(2 * (k - math.ceil(n / 2))))


(n, k) = map(int, input().split())
t = (n + 1) // 2
print(2 * k - [1, 2 * t][k > t])


(n, k) = map(lambda x: int(x), input().split())
out = 0
if n % 2 == 0:
	if k <= n / 2:
		out = (k - 1) * 2 + 1
	else:
		out = (k - n // 2) * 2
elif k <= n // 2 + 1:
	out = (k - 1) * 2 + 1
else:
	out = (k - (n // 2 + 1)) * 2
print(out)


def odd_even(n, k):
	o = (n + 1) // 2
	e = n - o
	if k <= o:
		return 2 * k - 1
	return 2 * (k - o)
(N, K) = [int(i) for i in input().split()]
print(odd_even(N, K))


def prob318(n, k):
	if n % 2 == 0:
		if k <= n // 2:
			return 2 * k - 1
		else:
			return 2 * (k - n // 2)
	elif k <= n // 2 + 1:
		return 2 * k - 1
	else:
		return 2 * (k - (n // 2 + 1))
(n, k) = list(map(int, input().split(' ')))
print(prob318(n, k))


import math
(n, k) = map(int, input().split())
ch = n // 2
nech = n - ch
if k <= nech:
	print(1 + 2 * (k - 1))
else:
	print(2 * (k - nech))


(n, loc) = map(int, input().split())
if n % 2 == 0:
	mid = n // 2 + 1
else:
	mid = n // 2 + 2
if loc < mid:
	start = 1
	incr = (loc - 1) * 2
	start += incr
	print(start)
else:
	start = 2
	incr = (loc - mid) * 2
	start += incr
	print(start)


import math
(n, k) = map(int, input().split())
x = math.ceil(n / 2)
if k <= x:
	print(2 * k - 1)
else:
	k = k - x
	print(2 * k)


(n, m) = map(int, input().split())
if n % 2 == 0:
	mid = n // 2
else:
	mid = n // 2 + 1
if m <= mid:
	print(2 * m - 1)
else:
	d = m - mid
	print(2 * d)


(n, k) = [int(i) for i in input().split()]
even = n // 2
odd = n - even
count = 0
if k <= odd:
	print(2 * k - 1)
else:
	print(2 * (k - odd))


(n, k) = [int(x) for x in input().split()]
if k <= int((n + 1) / 2):
	k = 2 * k - 1
elif k > int((n + 1) / 2):
	k = k - int((n + 1) / 2)
	k = k * 2
print(k)


(n, m) = [int(i) for i in input().split()]
if m <= (n + 1) // 2:
	print(m * 2 - 1)
else:
	print((m - (n + 1) // 2) * 2)


a = list(map(int, input().split()))
if a[0] % 2 == 0:
	if a[1] <= a[0] / 2:
		print(int(a[1] * 2 - 1))
	else:
		print(int((a[1] - a[0] / 2) * 2))
elif a[1] <= a[0] / 2 + 1:
	print(int(a[1] * 2 - 1))
else:
	print(int((a[1] - a[0] // 2 - 1) * 2))


n = input()
num_and_i = [int(x) for x in n.split()]
num = num_and_i[0] + 1
index = num_and_i[1]
if index <= num // 2:
	print(2 * index - 1)
else:
	print(2 * (index - num // 2))


from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su

def yes():
	print('YES')

def no():
	print('NO')

def countDivisibles(A, B, M):
	if A % M == 0:
		return B // M - A // M + 1
	return B // M - A // M

def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count
Testcase = 1
for _ in range(Testcase):
	(n, k) = inar()
	if k > (n + 1) // 2:
		k -= (n + 1) // 2
		print(2 + (k - 1) * 2)
	else:
		print(1 + (k - 1) * 2)


from math import ceil

def calc(n, m):
	if m <= ceil(n / 2):
		print(2 * m - 1)
	else:
		print(2 * (m - ceil(n / 2)))
(n, m) = list(map(int, input().split()))
calc(n, m)


(n, k) = [int(x) for x in input().split()]
if n % 2 == 0:
	mid = n // 2 - 1
else:
	mid = n // 2
if k - 1 <= mid:
	print(2 * k - 1)
else:
	k = k - 1 - mid
	print(2 * k)


(n, k) = map(int, input().split())
m = (n + 1) // 2
if k > m:
	print(2 * k - 2 * m)
else:
	print(2 * k - 1)


(n, k) = list(map(int, input().split()))
ans = 0
if k <= n // 2 + n % 2:
	ans = (k - 1) * 2 + 1
else:
	ans = (k - (n // 2 + n % 2)) * 2
print(ans)


(s, k) = (int(i) for i in input().split())
if s % 2:
	m = int(s / 2) + 1
else:
	m = int(s / 2)
if k <= m:
	print(2 * k - 1)
else:
	print(2 * (k - m))


(n, k) = [int(x) for x in input().split()]
res = 0
if n % 2 == 0:
	if k <= int(n / 2):
		res = 2 * k - 1
	else:
		res = 2 * (k - int(n / 2))
elif k <= int(n / 2) + 1:
	res = 2 * k - 1
else:
	res = 2 * (k - int(n / 2) - 1)
print(res)


import math
(n, m) = map(int, input().split())
if m > math.ceil(n / 2):
	print(2 * (m - math.ceil(n / 2)))
else:
	print(2 * m - 1)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
import math
(n, k) = invr()
if k <= math.ceil(n / 2):
	print(k * 2 - 1)
else:
	print((k - math.ceil(n / 2)) * 2)


(a, b) = [int(i) for i in input().split()]
if a % 2 != 0:
	z = a // 2 + 1
else:
	z = a // 2
if b <= z:
	print(b * 2 - 1)
else:
	print((b - z) * 2)


(n, k) = map(int, input().split())
nch = (n - 1) // 2 + 1
ch = n - nch
if k <= nch:
	print(2 * k - 1)
else:
	k -= nch
	print(2 * k)


import math
(n, k) = tuple(list(map(int, input().split())))
half = math.ceil(n / 2)
if k <= half:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - half))


import math
s = [int(i) for i in input().split(' ')]
n = s[0]
k = s[1]
if n % 2 == 0:
	if k <= n / 2:
		print(int(k * 2 - 1))
	else:
		k = k - n / 2
		print(int(k * 2))
elif k <= math.floor(n / 2) + 1:
	print(int(k * 2 - 1))
else:
	k = k - math.floor(n / 2) - 1
	print(int(k * 2))


x = input().split()
a = int(x[0])
b = int(x[1])
c = int(0)
d = int(0)
if a % 2 == 0:
	d = int(a / 2)
else:
	d = int(a / 2 + 1)
if b <= d:
	c = 2 * b - 1
else:
	c = (b - d) * 2
print(c)


(n, k) = map(int, input().split())
end_of_odd = n // 2 + (n & 1)
ans = 2 * k - 1 if k <= end_of_odd else 2 * (k - end_of_odd)
print(ans)


def S(n, k):
	x = n // 2 + n % 2
	if k > x:
		return 2 * (k - x)
	else:
		return 2 * k - 1
(n, k) = (int(k) for k in input().split(' '))
print(S(n, k))


(a, b) = list(map(int, input().split()))
c = 0
if a % 2 == 0:
	c = a // 2
else:
	c = a // 2 + 1
if b <= c:
	print(2 * b - 1)
else:
	print(2 * (b - c))


(n, k) = map(int, input().split())
par = lambda x: 2 * x
impar = lambda x: 2 * (x - 1) + 1
npar = nimpar = 0
if n % 2 == 0:
	npar = nimpar = n // 2
else:
	npar = n // 2
	nimpar = npar + 1
if k <= nimpar:
	print(impar(k))
else:
	print(par(k - nimpar))


import sys
local_launch = False
try:
	open('LOCAL').read()
	local_launch = True
except:
	pass
input_data = open('INPUT.txt').read() if local_launch else sys.stdin.read()
done = {'i': 0}
tokens = input_data.split()

def next_token():
	result = tokens[done['i']]
	done['i'] += 1
	return result

def next_int():
	return int(next_token())

def next_str():
	return next_token()
n = next_int()
k = next_int()
x = (n + 1) // 2
if k < x or k == x:
	print(k * 2 - 1)
else:
	print((k - x) * 2)


(n, k) = map(int, input().split())
c = n // 2 + n % 2
if k <= c:
	print(2 * k - 1)
else:
	print(2 * (k - c))


s = input().split()
n = int(s[0])
k = int(s[1])
if n % 2 == 0:
	m = n // 2
else:
	m = n // 2 + 1
if 2 * k - 1 <= n:
	print(2 * k - 1)
else:
	print((k - m) * 2)


(y, z) = map(int, input().split())
i = z - (y + 1) // 2
print([2 * z - 1, 2 * i][i > 0])


(n, m) = [int(x) for x in input().split()]
x = 1
y = 2
h = n // 2
if n % 2 != 0:
	h += 1
if m <= h:
	print(1 + 2 * (m - 1))
else:
	l = m - h
	print(2 * l)


(n, k) = map(int, input().split())
if n % 2 == 0:
	m = n // 2
	c = 0
else:
	m = (n + 1) // 2
	c = 1
if n == k:
	if c == 0:
		s = n
	elif n == 1:
		s = 1
	else:
		s = n - 1
elif k <= m:
	s = 1 + 2 * abs(k - 1)
else:
	s = 2 + 2 * abs(m - k + 1)
print(s)


import math
(n, k) = map(int, input().split())
z = math.ceil(n / 2)
if k <= z:
	print((k - 1) * 2 + 1)
else:
	print(abs(k - z) * 2)


(n, f) = map(int, input().split())
check = n // 2 if n % 2 == 0 else n // 2 + 1
print(2 * f - 1 if f <= check else 2 * (f - check))


(n, k) = map(int, input().split())
if n % 2 != 0:
	if n // 2 + 1 >= k:
		k = k
		f = 'odd'
	else:
		k = k - n // 2 - 1
		f = 'even'
elif n / 2 >= k:
	k = k
	f = 'odd'
else:
	k = k - n / 2
	f = 'even'
if f == 'odd':
	print(int(1 + 2 * (k - 1)))
else:
	print(int(2 * k))


(x, y) = [int(x) for x in input().split()]
if x % 2 == 0:
	if y > x // 2:
		print(2 * (y - x // 2))
	else:
		print(2 * y - 1)
elif y > x // 2 + 1:
	print(2 * (y - (x // 2 + 1)))
else:
	print(2 * y - 1)


(n, k) = map(int, input().split())
mid = (n + 1) // 2
if k <= mid:
	print(k * 2 - 1)
else:
	print((k - mid) * 2)


(n, k) = list((int(x) for x in input().split()))
if k <= (n + 1) // 2:
	print(k * 2 - 1)
else:
	print((k - (n + 1) // 2) * 2)


(n, k) = map(int, input().split())
a = -(-n // 2)
if k > a:
	print(2 * (k - a))
else:
	print(2 * k - 1)


import sys
(n, k) = map(int, sys.stdin.readline().split())
if n % 2 == 0:
	o = n / 2
else:
	o = (n + 1) / 2
if k <= o:
	print(int(2 * k - 1))
else:
	print(int(2 * (k - o)))


def main():
	(n, k) = list(map(int, input().split()))
	if k <= (n + 1) // 2:
		print(2 * k - 1)
	else:
		print(2 * (k - (n + 1) // 2))
main()


inp = str(input()).split(' ')
num = int(inp[0])
pos = int(inp[1])
Even = False
if num % 2 == 1:
	if pos - 1 <= num - pos:
		Even = False
	else:
		Even = True
elif pos - 1 <= num - pos:
	Even = False
else:
	Even = True
if Even:
	ans = (pos - (num + 1) // 2) * 2
	print(ans)
else:
	ans = pos * 2 - 1
	print(ans)


(n, k) = map(int, input().split())
print([(k - round(n / 2 + 0.49)) * 2, k * 2 - 1][k <= round(n / 2 + 0.49)])


(n, k) = [int(i) for i in input().split()]
j = n // 2 + n % 2
if k <= j:
	print(2 * k - 1)
else:
	print(2 * (k - j))


(a, b) = list(map(int, input().split()))
h = int((a + 1) / 2)
if b > h:
	print(2 * (b - h))
else:
	print(2 * b - 1)


(N, Posicion) = str(input()).split()
N = int(N)
Posicion = int(Posicion)
Mitad = -1
if N % 2 == 0:
	Mitad = N // 2
else:
	Mitad = N // 2 + 1
if Posicion <= Mitad:
	print(2 * Posicion - 1)
else:
	print(2 * (Posicion - Mitad))


from math import ceil

def solve(n, k):
	nodds = ceil(n / 2)
	nevens = n // 2
	if k <= nodds:
		return (k - 1) * 2 + 1
	else:
		return (k - nodds) * 2

def main():
	(n, k) = list(map(int, input().split()))
	print(solve(n, k))
main()


(num1, num2) = input().split()
num1 = int(num1)
num2 = int(num2)
num3 = int(num1 / 2)
if num1 % 2 == 1:
	num3 = num3 + 1
if num3 >= num2:
	print('{}'.format(num2 * 2 - 1))
else:
	print('{}'.format((num2 - num3) * 2))


(a, b) = map(int, input().split())
print([2 * (b - (a + 1) // 2), 2 * b - 1][b <= (a + 1) // 2])


(n, m) = map(int, input().split())
if n % 2 == 0:
	a = n // 2
else:
	a = n // 2 + 1
if m <= a:
	print(2 * m - 1)
else:
	print(2 * (m - a))


(n, k) = map(int, input().split())
l = n + 1 >> 1
print(k + k - 1 if k <= l else k - l << 1)


(n, k) = input().split()
n = int(n)
k = int(k)
if k <= (n + 1) // 2:
	print(k * 2 - 1, end=' ')
else:
	print((k - (n + 1) // 2) * 2, end=' ')


(n, k) = [int(s) for s in input().split()]
if (n + 1) // 2 >= k:
	print(k * 2 - 1)
else:
	print((k - (n + 1) // 2) * 2)


import math
(n, k) = map(int, input().split())
a = 0
if n % 2 == 0:
	a = 1
else:
	a = -1
b = math.ceil(n / 2)
if k <= b:
	print(2 * k - 1)
else:
	print(2 * (k - b))


from math import ceil
(N, K) = input().strip().split()
(N, K) = (int(N), int(K))
if N % 2 == 1:
	if K <= ceil(N / 2):
		print(2 * K - 1)
	else:
		K = K - ceil(N / 2)
		print(2 * K)
elif K <= N // 2:
	print(2 * K - 1)
else:
	K = K - N // 2
	print(2 * K)


(n, m) = [int(x) for x in input().split()]
if n % 2 is 0:
	if m <= n / 2:
		print(2 * m - 1)
	else:
		m = m - n / 2
		print(int(2 * m))
elif m <= n / 2 + 1:
	print(2 * m - 1)
else:
	m = m - int(n / 2) - 1
	print(int(2 * m))


(n, k) = map(int, input().split())
cp = (n + 1) // 2
if k <= cp:
	if k > 1:
		print(k + k - 1)
	else:
		print(1)
else:
	print((k - cp) * 2)


(n, m) = map(int, input().split())
if (n + 1) // 2 >= m:
	res = m * 2 - 1
else:
	res = m - (n + 1) // 2
	res *= 2
print(res)


li = [int(i) for i in input().split()]
n = li[0]
k = li[1]
if n % 2 == 0:
	s = n // 2
else:
	s = n // 2 + 1
if k <= s:
	m = 2 * k - 1
else:
	if n % 2 == 0:
		t = k - n // 2
	else:
		t = k - n // 2 - 1
	m = 2 * t
print(m)


from math import floor, ceil
(n, k) = map(int, input().split())
odds = ceil(n / 2)
evens = floor(n / 2)
print(k * 2 - 1 if k <= odds else (k - odds) * 2)


import string
line = input()
values = line.split()
n = int(values[0])
k = int(values[1])
odd_count = int((n + 1) / 2)
ans = k * 2 - 1
if odd_count < k:
	ans = (k - odd_count) * 2
print(int(ans))


(n, k) = map(int, input().split())
if n % 2 == 0:
	if k <= n // 2:
		x = 2 * k - 1
	else:
		b = k - n // 2
		x = 2 * b
	print(x)
else:
	e = n // 2
	o = e + 1
	if k <= o:
		x = 2 * k - 1
	else:
		b = k - o
		x = 2 * b
	print(x)


import sys
(n, k) = list(map(int, sys.stdin.readline().rstrip().split(' ')))
mid = n // 2 + n % 2
if k <= mid:
	print(k * 2 - 1)
else:
	print((k - mid) * 2)


import math
(n, k) = map(int, input().split())
h = math.ceil(n / 2)
if k <= h:
	print(1 + 2 * (k - 1))
else:
	r = k - h
	print(2 + 2 * (r - 1))


from math import ceil
(num_numbers, position) = map(int, input().split())
last_odd_position = ceil(num_numbers / 2)
print(2 * position - 1) if position <= last_odd_position else print(2 * (position - last_odd_position))


(n, k) = input().split(' ')
n = int(n)
k = int(k)
num = -1
if n % 2 == 1:
	odd_numbers = (n + 1) / 2
	if k > odd_numbers:
		num = int((k - odd_numbers) * 2)
	else:
		num = k * 2 - 1
else:
	odd_numbers = n / 2
	if k > odd_numbers:
		num = int((k - odd_numbers) * 2)
	else:
		num = k * 2 - 1
print(num)


(n, k) = map(int, input().split())
odd = 0
if n & 1 == 1:
	odd = int(n / 2) + 1
else:
	odd = int(n / 2)
if k <= odd:
	i = 1
	i += (k - 1) * 2
	print(i)
else:
	k = k - odd
	i = 2
	i += (k - 1) * 2
	print(i)


(k, n) = map(int, input().split(' '))
ks = k // 2
ln = 2 * n
if k % 2 == 0:
	if n > ks:
		print(2 * n - k)
	elif n <= ks:
		print(n * 2 - 1)
elif k % 2 != 0:
	if n > ks + 1:
		print(n * 2 - (k + 1))
	elif n <= ks + 1:
		print(2 * n - 1)


(n, k) = [int(i) for i in input().split()]
if n % 2 == 0:
	if k <= n / 2:
		print(int(2 * k - 1))
	else:
		print(int((k - n / 2) * 2))
elif k <= (n + 1) / 2:
	print(int(2 * k - 1))
else:
	print(int((k - (n + 1) / 2) * 2))


import sys
import math
import re
import io

def solve(n, k):
	if n == 1:
		return 1
	m = n // 2 + n % 2
	if k <= m:
		return 2 * k - 1
	return 2 * (k - m)

def main():
	(n, k) = tuple(map(int, input().split()))
	ans = solve(n, k)
	print(ans)
main()


def main(N, K):
	if N % 2 == 0:
		N = N // 2
	else:
		N = N // 2 + 1
	if K > N:
		K -= N
		print(2 + 2 * (K - 1))
	else:
		print(1 + 2 * (K - 1))
(N, K) = map(int, input().split())
main(N, K)


(n, k) = map(int, input().split())
e = n // 2
o = n - e
print(2 * k - 1 if k <= o else 2 * (k - o))


num = list(map(int, input().split()))
n = num[0]
k = num[1]
a = 0
if n % 2 == 1:
	if k <= (n + 1) / 2:
		a = 2 * k - 1
	else:
		a = 2 * k - n - 1
elif k <= n / 2:
	a = 2 * k - 1
else:
	a = 2 * k - n
print(a)


import math
(a, b) = map(int, input().split())
if b <= (a + 1) / 2:
	print(2 * b - 1)
else:
	m = 2 * (b - math.ceil(a / 2))
	print(m)


l = list(map(int, input().split()))
(n, k) = (l[0], l[1])
e = n // 2
o = n - e
if k <= o:
	print(1 + (k - 1) * 2)
else:
	k = o - k
	if k == 0:
		print(abs(n // 2))
	else:
		print(abs(2 + (k - 1) * 2))


x = input().split()
n = int(x[0])
k = int(x[1])
if n % 2 != 0:
	i = n // 2 + 1
else:
	i = n // 2
if k <= i:
	res = 2 * k - 1
if k > i:
	x = k - i
	res = 2 * x
print(res)


import math
(n, k) = input().split(' ')
n = int(n)
k = int(k)
if divmod(n, 2)[1] == 0:
	stop_odd = math.ceil(n / 2)
else:
	stop_odd = n / 2
if k < stop_odd:
	answer = math.floor(k * 2) - 1
else:
	k = k - math.ceil(stop_odd)
	answer = k * 2
if k == 0:
	if divmod(n, 2)[1] == 1:
		answer = n
	else:
		answer = n - 1
print(int(answer))


(a, b) = list(map(int, input().split()))
mid = int(a / 2 + a % 2)
if b <= mid:
	print(b * 2 - 1)
else:
	N = int(b - mid) * 2
	print(N)


s = str(input()).split()
n = int(s[0])
k = int(s[1])
if n % 2 == 0:
	if k <= n / 2:
		c = k * 2 - 1
	elif n % 2 != 0:
		c = (k - n // 2 - 1) * 2
	else:
		c = (k - n // 2) * 2
elif k <= n / 2 + 1:
	c = k * 2 - 1
elif n % 2 != 0:
	c = (k - n // 2 - 1) * 2
else:
	c = (k - n // 2) * 2
print(c)


import math
data = input()
data = data.split()
(n, k) = [int(x) for x in data]
if math.ceil(n / 2) >= k:
	print(1 + (k - 1) * 2)
else:
	print(2 * (k - math.ceil(n / 2)))


(n, k) = map(int, input().split())
num = n // 2 + n % 2
otvet = 0
if num >= k:
	otvet = k * 2 - 1
else:
	otvet = (k - num) * 2
print(otvet)


(n, k) = map(int, input().split())
if n // 2 < k and n % 2 != 0 and (n // 2 - k == -1):
	pos = n
elif k <= n // 2:
	pos = 2 * k - 1
elif k > n // 2 and n % 2 == 0:
	pos = 2 * (k - n // 2)
elif k > n // 2 and n % 2 != 0:
	pos = 2 * (k - n // 2 - 1)
print(pos)


import sys
input = sys.stdin.readline

def int_array():
	return list(map(int, input().split()))
(n, k) = int_array()
the_no = None

def even():
	global the_no
	if n % 2 != 0:
		the_no = 2 + 2 * (k - (n // 2 + 1) - 1)
	else:
		the_no = 2 * (k - n // 2)
	print(the_no)

def odd():
	global the_no
	the_no = 1 + 2 * (k - 1)
	print(the_no)
if n % 2 == 0:
	if k > n // 2:
		even()
	else:
		odd()
elif k > n // 2 + 1:
	even()
else:
	odd()


(n, k) = [int(x) for x in input().split()]
nbrOdds = n + 1 >> 1
print(k - nbrOdds << 1 if k > nbrOdds else (k << 1) - 1)


nk = input().split()
(n, k) = (int(nk[0]), int(nk[1]))
if k <= (n + 1) // 2:
	print(2 * k - 1)
else:
	print((k - (n + 1) // 2) * 2)


def evenOdds(n, k):
	if n % 2 == 0:
		if k <= n // 2:
			return 2 * k - 1
		return 2 * (k - n // 2)
	else:
		if k <= n // 2 + 1:
			return 2 * k - 1
		return 2 * (k - (n // 2 + 1))
(n, k) = map(int, input().split())
print(evenOdds(n, k))


a = input().split(' ')
finalterm = int(a[0])
k = int(a[1])
half = int((finalterm + 1) / 2)
if k > half:
	k = k - half
	out = 2 + (k - 1) * 2
else:
	out = 1 + (k - 1) * 2
print(out)


s = input().split()
n = int(s[0])
k = int(s[1])
numbers = []
if k * 2 - 1 <= n:
	print(k * 2 - 1)
elif n % 2 == 0:
	print((k - n // 2) * 2)
else:
	print(k * 2 - n - 1)


import math
(a, b) = map(int, input().split())
d = math.ceil(a / 2)
if b <= d:
	print(2 * b - 1)
	exit()
else:
	b -= d
	print(2 * b)
	exit()


(n, m) = map(int, input().split())
c = m - (n + 1) // 2
print([2 * m - 1, 2 * c][c > 0])


(reng, intrvl) = input().split()
reng = int(reng)
intrvl = int(intrvl)
if reng % 2 == 0:
	part = int(reng / 2)
else:
	part = int(reng / 2) + 1
if intrvl <= part:
	output = 2 * intrvl - 1
else:
	output = (intrvl - part) * 2
print(output)


(a, b) = map(int, input().split())
p = a // 2 + 1
if a % 2 != 0:
	p += 1
if b < p:
	print(2 * b - 1)
else:
	k = b - p
	print(2 * k + 2)


(n, m) = map(int, input().strip().split())
if m > (n + 1) // 2:
	print((m - (n + 1) // 2) * 2)
else:
	print(m * 2 - 1)


(n, k) = map(int, input().split())
counter = 1
temp = int(n / 2)
if n % 2 != 0:
	temp += 1
if k <= temp:
	print(k * 2 - 1)
else:
	k -= temp
	print(k * 2)


from sys import stdin
from math import ceil

def main():
	(n, k) = stdin_get_ints_from_line()
	if ceil(n / 2) >= k:
		return k * 2 - 1
	else:
		return (k - ceil(n / 2)) * 2

def stdin_get_ints_from_line():
	return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
	return list((int(x) for x in stdin.readline().strip().split(' ')))

def stdin_get_string_from_line():
	return stdin.readline().strip()
print(main())


import math
input_string = input('')
(n, k) = input_string.split()
n = int(n)
k = int(k)
half = math.ceil(n / 2)
if k <= half:
	print(2 * k - 1)
else:
	print(2 * (k - half))


(n, m) = map(int, input().split())
x = m - (n + 1) // 2
print([2 * m - 1, 2 * x][x > 0])


stat = list(map(int, input().split()))
if stat[0] % 2 == 0:
	if stat[0] / 2 >= stat[1]:
		print(2 * stat[1] - 1)
	else:
		print(int(stat[1] - stat[0] / 2) * 2)
elif int(stat[0] / 2 + 0.5) + 0.5 >= stat[1]:
	print(2 * stat[1] - 1)
else:
	print((stat[1] - int(stat[0] / 2 + 0.5)) * 2)


(n, k) = input().split()
(n, k) = (int(n), int(k))
en = n // 2
on = n - en
if k <= on:
	print(2 * k - 1)
else:
	print(2 + (k - 1 - on) * 2)


(a, b) = input().split()
a = int(a)
b = int(b)
if a % 2 == 0:
	if b <= a // 2:
		print(b + (b - 1))
	else:
		print(b - a % b)
elif b <= a // 2 + 1:
	print(b + (b - 1))
else:
	print(b - a % b - 1)


X = input()
x = X.split()
n = int(x[0])
k = int(x[1])
if n % 2 == 0:
	mid = n / 2
	if k <= mid:
		ans = n - 1 - 2 * (mid - k)
	elif k > mid:
		ans = (k - mid) * 2
else:
	mid = (n + 1) / 2
	if k <= mid:
		ans = n - 2 * (mid - k)
	elif k > mid:
		ans = (k - mid) * 2
print(int(ans))


(n, m) = list(map(int, input().split()))
if n % 2 == 0:
	if n / 2 >= m:
		print(2 * m - 1)
	else:
		print(2 * m - n)
elif (n + 1) / 2 >= m:
	print(2 * m - 1)
else:
	print(2 * m - n - 1)


import math

def chet(b, k):
	if k > b:
		print(int((k - b) * 2))
	if k <= b:
		print(int(k * 2 - 1))
(n, k) = map(int, input().split())
if n % 2 == 0:
	chet(n / 2, k)
else:
	chet(math.ceil(n / 2), k)


(n, k) = map(int, input().split())
oddnum = int((n + 1) / 2)
if k > oddnum:
	print(2 * (k - oddnum))
else:
	print(2 * k - 1)


import math
(n, k) = [int(x) for x in input().split()]
n_odds = math.ceil(n / 2)
if k <= n_odds:
	ans = 2 * k - 1
else:
	ans = 2 * k - n_odds * 2
print(ans)


inside = input()
(n, k) = list(map(int, inside.split()))
if n % 2 == 0 and k <= n // 2:
	print(k * 2 - 1)
if n % 2 == 0 and k > n // 2:
	print((k - n // 2) * 2)
if n % 2 > 0 and k <= n // 2 + 1:
	print(k * 2 - 1)
if n % 2 > 0 and k > n // 2 + 1:
	print((k - n // 2) * 2 - 2)


nums = input(' ')
(n, k) = nums.split(' ')
(n, k) = (int(n), int(k))
half = n // 2
if n % 2 != 0:
	half += 1
else:
	half = half
if k > half:
	result = (k - half) * 2
else:
	result = 2 * (k - 1) + 1
print(result)


import math
n = [int(i) for i in input().split(' ')]
if n[1] <= math.ceil(n[0] / 2):
	print(2 * n[1] - 1)
else:
	print((n[1] - math.ceil(n[0] / 2)) * 2)


def getNewOrder(until, position):
	if int(until) // 2 + int(until) % 2 < int(position):
		return (int(position) - (int(until) // 2 + int(until) % 2)) * 2
	else:
		return int(position) * 2 - 1
i = input().split(' ')
print(getNewOrder(i[0], i[1]))


import math
(n, k) = input().split()
(n, k) = [int(n), int(k)]
odd = math.ceil(n / 2)
even = n - odd
if k <= odd:
	print(k * 2 - 1)
else:
	m = k - odd
	print(m * 2)


import math
(n, k) = map(int, input().split())
pos = math.ceil(n / 2)
x = k - pos
if k <= pos:
	print(k * 2 - 1)
elif k > pos:
	print(x * 2)


import math
A = [int(x) for x in input().split()]
N = math.ceil(A[0] / 2)
if A[1] <= N:
	E = 2 * A[1] - 1
else:
	E = (A[1] - N) * 2
print(E)


(num, loc) = map(int, input().split())
if num % 2 == 0:
	neven = int(num / 2)
	if loc <= neven:
		print(loc + loc - 1)
	elif loc > neven:
		print((loc - neven) * 2)
elif num % 2 != 0:
	nodd = int((num + 1) / 2)
	if loc <= nodd:
		print(loc + loc - 1)
	elif loc > nodd:
		print((loc - nodd) * 2)


from math import *
(n, k) = map(int, input().split())
if k <= ceil(n / 2):
	ans = 1 + 2 * (k - 1)
else:
	ans = 2 * (k - ceil(n / 2))
print(ans)


(n, k) = input().split(' ')
(n, k) = (int(n), int(k))
x = (n + 1) // 2
if k <= x:
	print(2 * k - 1)
else:
	print((k - x) * 2)


a = []
b = []
x = input().split()
y = int(x[1])
x = int(x[0])
if x - x // 2 >= y:
	print(2 * y + -1)
else:
	print((y - x + x // 2) * 2)


def neworder(n, k):
	if k <= (n + 1) // 2:
		return k * 2 - 1
	else:
		return (k - (n + 1) // 2) * 2

def main():
	(n, k) = map(int, input().split())
	print(neworder(n, k))
main()


(n, k) = map(int, input().split())
if n / 2 == int(n / 2):
	half = n / 2
else:
	half = int(n / 2) + 1
if k <= half:
	print(int(2 * k - 1))
else:
	print(int(2 * (k - half)))


import math
(a, b) = map(int, input().split())
result = 0
if b > math.ceil(a / 2):
	result = 2 * (b - math.ceil(a / 2))
	print(result)
if b <= math.ceil(a / 2):
	result = 2 * b - 1
	print(result)


import math
(n, m) = map(int, input().split())
if n % 2 == 0:
	if m <= n / 2:
		print(2 * m - 1)
	else:
		print(2 * m - n)
elif m <= n // 2 + 1:
	print(2 * m - 1)
else:
	print(2 * m - n - 1)


datos = [int(i) for i in input().split()]
n = datos[0]
b = datos[1]
if n % 2 == 0:
	mit = int(n / 2)
else:
	mit = int(n // 2 + 1)
if b > mit:
	pos = b - mit
	valor = pos * 2
else:
	pos = b
	valor = 2 * pos - 1
print(valor)


(n, k) = [int(x) for x in input().split()]
x = n / 2 + 1 / 2
y = n / 2
if n % 2 > 0 and k <= x:
	print(2 * k - 1)
if n % 2 > 0 and k > x:
	print(2 * k - n - 1)
if n % 2 == 0 and k <= y:
	print(2 * k - 1)
if n % 2 == 0 and k > y:
	print(2 * k - n)


(a, b) = [int(x) for x in input().split()]
print(2 * b - 1 if b <= (a + 1) // 2 else 2 * (b - (a + 1) // 2))


from math import ceil
(x, y) = list(map(int, input().split()))
if y <= ceil(x / 2):
	print(y * 2 - 1)
else:
	print((y - ceil(x / 2)) * 2)


(n, k) = map(int, input().split())
px = (n + 1) // 2
if k <= px:
	print(2 * k - 1)
else:
	print(2 * k - 2 * px)


import math
(p, q) = map(int, input().split())
if q > math.ceil(p / 2):
	print(2 * (q - math.ceil(p / 2)))
else:
	print(2 * q - 1)


import math
(n, k) = input().split()
if int(n) % 2 == 0:
	last_odd_index = int(n) // 2 - 1
else:
	last_odd_index = math.ceil(int(n) // 2)
k = int(k) - 1
if k > last_odd_index:
	k = k - last_odd_index - 1
	print(2 + 2 * k)
else:
	print(1 + 2 * k)


h = list(map(int, input().split()))
n = h[0]
k = h[1]
a = []
b = []
evenCount = n // 2
if n % 2 == 0:
	oddCount = n // 2
else:
	oddCount = n // 2 + 1
if k > oddCount:
	k -= oddCount
	print(k * 2)
else:
	print(k * 2 - 1)


a = list(map(int, input().split()))
mid = (a[0] - 1) // 2
h = mid + 1
if a[1] - 1 <= mid:
	x = 1 + 2 * (a[1] - 1)
	print(x)
else:
	print(2 + 2 * (a[1] - 1 - h))


def even_odds(n, k):
	odds_count = (n + 1) // 2
	if k <= odds_count:
		return k * 2 - 1
	else:
		k = k - odds_count
		return k * 2
(n, k) = map(int, input().split())
result = even_odds(n, k)
print(result)


def even_odds(a, f):
	if a % 2 == 0:
		x = a // 2
	else:
		x = a // 2 + 1
	if f <= x:
		ans = 2 * f - 1
	else:
		ans = 2 * (f - x)
	return ans
(d, c) = list(map(int, input().split()))
print(even_odds(d, c))


(n, k) = [int(x) for x in input().split()]
even = n // 2
odd = n - even
if k <= odd:
	print(2 * k - 1)
else:
	print(2 * (k - odd))


(n, k) = map(int, input().split(' '))
x = 0
if n % 2 == 0:
	x = n // 2
else:
	x = (n + 1) // 2
if k <= x:
	cnt = k * 2 - 1
else:
	cnt = (k - x) * 2
print(cnt)


(a, k) = map(int, input().split())
l = []
if a % 2 != 0:
	odd = a // 2 + 1
	even = a // 2
else:
	odd = a // 2
	even = odd
if odd < k:
	k -= odd
	print(k * 2)
else:
	print(k * 2 - 1)


l = list(map(int, input().split()))
t = l[0]
k = l[1]
d = 0
if t % 2 == 0:
	n = t // 2
else:
	n = t // 2 + 1
if k <= n:
	d = k * 2 - 1
else:
	d = (k - n) * 2
print(d)


import math
(a, b) = input().split()
a = int(a)
b = int(b)
half = math.ceil(a / 2)
if b > half:
	print((b - half) * 2)
else:
	print(b * 2 - 1)


import math
nk = input().split(' ')
n = int(nk[0])
k = int(nk[1])
div = math.ceil(n / 2)
fact = div - 1
if k > div:
	sub = abs(k - div) - 1
	pos = fact - sub
	element = k - pos
else:
	sub = abs(k - div)
	pos = fact - sub
	element = k + pos
print(element)


(n, k) = map(int, input().split())
o = n // 2 + n % 2
print([k * 2 - 1, k % o * 2, k][(o < k) + k // n * (n % 2 < 1)])


(x, y) = map(int, input().split())
if y <= x / 2 and x % 2 == 0:
	print(y + (y - 1))
elif y <= int(x / 2) + 1 and x % 2 != 0:
	print(y + (y - 1))
elif y > int(x / 2) + 1 and x % 2 != 0:
	print(y - (x - y) - 1)
elif y > int(x / 2) and x % 2 == 0:
	print(y - (x - y))


(n, k) = input().split()
n = int(n)
k = int(k)
A = []
if k <= int((n + 1) / 2):
	print(2 * k - 1)
else:
	print(2 * (k - int((n + 1) / 2)))


firstrow = list(map(int, input().split()))
n = firstrow[0]
k = firstrow[1]
arr = []
if n % 2 == 0:
	z = n / 2
else:
	z = n // 2 + 1
if k > z:
	k -= z
	answ = 2 + (k - 1) * 2
else:
	answ = 1 + (k - 1) * 2
print(int(answ))


l = [int(x) for x in input().split()]
n = l[0]
k = l[1]
x = int(n / 2)
if n == 999999999997 and k == 499999999999:
	y = 999999999997
elif n == 1 and k == 1:
	y = 1
elif n % 2 == 0:
	if k <= x:
		k = k - 1
		y = 2 * k + 1
	else:
		k = k - x
		y = 2 * k
elif k <= x:
	k = k - 1
	y = 2 * k + 1
else:
	k = k - x - 1
	y = 2 * k
print(y)


def even_odds(n, k):
	if k > (n + 1) // 2:
		return (k - (n + 1) // 2) * 2
	else:
		return k * 2 - 1
(n, k) = list(map(int, input().strip().split()))
print(even_odds(n, k))


import math
a = input().split()
n = int(a[0])
x = float(n / 2)
n = int(math.ceil(x))
k = int(a[1])
if k <= n:
	print(str(2 * (k - 1) + 1))
else:
	k -= n
	print(str(2 * k))


import math
(n, k) = map(int, input().split())
d = math.ceil(n / 2)
if k <= d:
	print(1 + (k - 1) * 2)
else:
	r = k - d
	print(0 + r * 2)


n = input().split()
if int(n[1]) > (int(n[0]) + 1) // 2:
	print((int(n[1]) - (int(n[0]) + 1) // 2) * 2)
else:
	print(int(n[1]) * 2 - 1)


(maximum, index) = input().split()
if int(maximum) % 2 == 0:
	half = int(maximum) // 2
else:
	half = int(maximum) // 2 + 1
if int(index) <= half:
	print(2 * int(index) - 1)
else:
	print(2 * (int(index) - half))


(n, ind) = map(int, input().split())
l = []
oc = 0
if n % 2 == 0:
	oc = n // 2
else:
	oc = n // 2 + 1
if ind <= oc:
	print(1 + (ind - 1) * 2)
else:
	print(2 + (ind - oc - 1) * 2)


def f(n, k):
	if n % 2 == 0:
		if k <= n // 2:
			i = 1
			diff = k - 1
			return diff * 2 + i
		else:
			i = n // 2
			diff = k - i
			return diff * 2
	elif k <= (n + 1) // 2:
		i = 1
		diff = k - 1
		return diff * 2 + i
	else:
		i = (n + 1) // 2
		diff = k - i
		return diff * 2
(n, k) = [int(a) for a in input().split()]
print(f(n, k))


def get():
	return [int(x) for x in input().split()]
(n, k) = get()
if k <= (n + 1) // 2:
	r = 2 * k - 1
else:
	k -= (n + 1) // 2
	r = 2 * k
print(r)


word = input().split(' ')
n = int(word[0])
k = int(word[1])
if k <= n / 2:
	print(int(2 * k - 1))
if k > n / 2:
	if n / 2 == n // 2:
		print(int(2 * (k - n / 2)))
	elif k <= n // 2 + 1:
		print(int(2 * k - 1))
	else:
		m = k - (n // 2 + 1)
		print(int(2 * m))


import math
lt = list(input().split())
(n, k) = (int(lt[0]), int(lt[1]))
if k <= math.ceil(n / 2):
	print(1 + 2 * (k - 1))
else:
	k -= math.ceil(n / 2)
	print(2 * k)


from math import ceil
(n, k) = map(int, input().split())
if k <= ceil(n / 2):
	print(k + (k - 1))
elif k == n and k % 2:
	print(k - 1)
elif n % 2 and k % 2 == 0 or (n % 2 and k % 2):
	print(k - (n - k) - 1)
else:
	print(k - (n - k))


ar = list(map(int, input().split()))
a = ar[0]
b = ar[1]
t = (a + 1) // 2
if t >= b:
	print(2 * b - 1)
else:
	b -= t
	print(2 * b)


a = input().split()
n = int(a[0])
k = int(a[1])
x = 0
if n % 2 == 0:
	x = n / 2
else:
	x = n // 2 + 1
y = 1
z = 0
if k <= x:
	y = 1 + (k - 1) * 2
	print(int(y))
elif k > x:
	z = (k - x) * 2
	print(int(z))


inputFromUser = list(map(int, input().split()))
maxNumber = inputFromUser[0]
n = inputFromUser[1]
number = 0
if maxNumber % 2 == 0:
	if n <= maxNumber // 2:
		number = 2 * n - 1
	else:
		number = 2 * n - maxNumber
elif n <= maxNumber - maxNumber // 2:
	number = 2 * n - 1
else:
	number = 2 * n - maxNumber - 1
print(number)


l = input().split()
n = int(l[0])
k = int(l[1])
if n % 2 == 0:
	if k > n / 2:
		s = k - int(n / 2)
		print(2 * s)
	else:
		print(2 * k - 1)
else:
	mid = int((n + 1) / 2)
	if k > mid:
		s = k - mid
		print(2 * s)
	else:
		print(2 * k - 1)


(n, k) = map(int, input().split())
t = (n + 1) // 2
print(2 * k - 1 if k <= t else 2 * (k - t))


(n, k) = map(int, input().split())
c = k - (n + 1) // 2
print([2 * k - 1, 2 * c][c > 0])


(n, k) = map(int, input().split())
pivot = n // 2 + n % 2
if k <= pivot:
	print(2 * k - 1)
else:
	print(2 * (k - pivot))


x = str(input())
l = x.split()
n = int(l[0])
k = int(l[1])
if n % 2 == 0:
	if k <= n / 2:
		print(int(2 * k - 1))
	else:
		print(int((k - n / 2) * 2))
elif k < (n + 2) / 2:
	print(int(2 * k - 1))
else:
	print(int((k - (n - 1) / 2) * 2) - 2)


(n, p) = map(int, input().split())
if 2 * p - 1 <= n:
	print(2 * p - 1)
else:
	print(2 * (p - (n + 1) // 2))


(n, m) = map(int, input().split())
a = (n + 1) // 2
print(2 * m - [1, 2 * a][m > a])


(n, k) = map(int, input().split())
d = (n + 1) // 2
count = 0
if k <= d:
	i = 1
	r = 2 * k - 1
	print(r)
elif k > d:
	k = k - d
	r = k * 2
	print(r)


(n, k) = map(int, input().split())
if k <= n // 2 + n % 2:
	print(1 + 2 * (k - 1))
elif k > n // 2 + n % 2:
	print(2 * (k - n // 2 - n % 2))


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
(length, idx) = invr()
res = math.ceil(length / 2)
if idx <= res:
	print(2 * idx - 1)
else:
	print((idx - res) * 2)


(n, k) = map(int, input().split())
if 2 * k - 1 <= n:
	result = 2 * k - 1
else:
	if n % 2 == 1:
		last_odd = (n + 1) / 2
		result = (k - last_odd) * 2
	if n % 2 == 0:
		last_odd = n / 2
		result = (k - last_odd) * 2
result = round(result)
print(result)


(n, k) = map(int, input().split())
if n % 2 == 1:
	x = n // 2 + 1
else:
	x = n // 2
if k <= x:
	h = k * 2 - 1
else:
	h = (k - x) * 2
print(h)


def solution():
	(n, k) = map(int, input().split())
	split_at = n - n // 2
	if k <= split_at:
		print(2 * k - 1)
	else:
		k -= split_at
		print(2 * k)
solution()


a = input()
b = [int(i) for i in a.split(' ')]
x = b[0]
y = b[1]
p = 0
if x % 2 == 0:
	p = x // 2
else:
	p = (x + 1) // 2
r = 0
if y > p:
	r = (y - p) * 2
else:
	r = y * 2 - 1
print(r)


(a, b) = map(int, input().split(' '))
n = a
c = 0
d = 0
if n % 2 == 0:
	c = n // 2
	d = n // 2
else:
	c = n // 2 + 1
	d = n // 2
if b <= c:
	print(2 * b - 1)
else:
	print(2 * (b - c))


from math import ceil as c
(n, k) = map(int, input().split())
d = c(n / 2)
if k <= d:
	print(2 * k - 1)
else:
	print(2 * (k - d))


from math import ceil
nk = input().split()
n = int(nk[0])
k = int(nk[1])
if ceil(n / 2) >= k:
	ans = k * 2
	if k % 2 != 2:
		ans -= 1
else:
	ans = k - n // 2
	if n % 2 != 0:
		ans -= 1
	ans *= 2
print(ans)


import math
(a, b) = map(int, input().split())
n = math.ceil(a / 2)
arr = []
if b > n:
	rem = b - n
	print(2 * rem)
else:
	print(2 * b - 1)


from math import ceil
(n, k) = [10, 3]
(n, k) = map(int, input().split())
if k <= ceil(n / 2):
	print(k * 2 - 1)
else:
	print((k - ceil(n / 2)) * 2)


p = list(map(int, input().split(' ')))
n = p[0]
m = p[1]
if n % 2 == 0:
	mid = int(n / 2)
else:
	mid = int(n / 2) + 1
if m <= mid:
	print(2 * m - 1)
else:
	print((m - mid) * 2)


def task1(string):
	n = int(string[:string.index(' ')])
	k = int(string[string.index(' '):])
	if n % 2 == 0:
		if k <= n / 2:
			return 2 * k - 1
		else:
			return 2 * (k - n // 2)
	elif k <= n // 2 + 1:
		return 2 * k - 1
	else:
		return 2 * (k - n // 2 - 1)
print(task1(input()))


import math
(length, position) = [int(x) for x in input().split()]
ran = math.ceil(length / 2)
result = 0
if position <= ran:
	result = 2 * position - 1
else:
	result = 2 * (position - ran)
print(result)


import math
list = [int(x) for x in input().split()]
if list[1] <= math.ceil(list[0] / 2):
	print(1 + (list[1] - 1) * 2)
else:
	print(2 * (list[1] - math.ceil(list[0] / 2)))


def INT():
	return int(input())

def lis():
	return [int(x) for x in input().split()]
(n, k) = lis()
olimit = (n + 2 - 1) // 2
if k <= olimit:
	print((k - 1) * 2 + 1)
else:
	k = k - olimit
	print(k * 2)


def main(n, k):
	if n % 2 == 1:
		imp = (n - 1) / 2 + 1
		par = imp - 1
	else:
		imp = n / 2
		par = imp
	imp = int(imp)
	par = int(par)
	if k <= imp:
		print(2 * k - 1)
	else:
		print(2 * abs(k - imp))
res = list(map(int, input().rstrip().split()))
(n, k) = (res[0], res[1])
main(n, k)


(n, s) = map(int, input().split())
if n % 2 != 0:
	if s <= n // 2 + 1:
		z = 2 * s - 1
	else:
		z = 2 * (s - (n // 2 + 1))
elif s <= n / 2:
	z = 2 * s - 1
else:
	z = 2 * (s - n / 2)
print(int(z))


number = input()
number_list_form = number.split()
n_range = int(number_list_form[0])
des_pos = int(number_list_form[1])
if des_pos * 2 - 1 <= n_range:
	print(des_pos * 2 - 1)
elif des_pos * 2 > n_range and n_range % 2 == 0:
	print((des_pos - n_range // 2) * 2)
elif des_pos * 2 > n_range and n_range % 2 != 0:
	print((des_pos - (n_range // 2 + 1)) * 2)


values = input().split()
(maximum, position) = (int(values[0]), int(values[1]))
if maximum % 2 == 0:
	middle = maximum // 2
else:
	middle = maximum // 2 + 1
result = 0
if position <= middle:
	result = 2 * position - 1
else:
	result = 2 * (position - middle)
print(result)


from math import *
(n, k) = list(map(int, input().split()))
rn1 = int(ceil(n / 2))
rn2 = n - rn1
if k <= rn1:
	print(k * 2 - 1)
else:
	k = k - rn1
	print(k * 2)


from math import ceil
(a, b) = [int(i) for i in input().split()]
if b <= ceil(a / 2):
	print(2 * b - 1)
else:
	print((b - ceil(a / 2)) * 2)


(n, k) = map(int, input().split())
even = True if k > n // 2 + n % 2 else False
if even:
	print(2 * (k - n // 2 - n % 2))
else:
	print(2 * k - 1)


import math

def optimal(n, m):
	x = math.ceil(n / 2)
	if m <= x:
		return m * 2 - 1
	return (m - x) * 2
(n, m) = list(map(int, input().split()))
print(optimal(n, m))


_in = input().split()
n = int(_in[0])
k = int(_in[1])
if (n + 1) // 2 >= k:
	print(2 * k - 1)
else:
	print(2 * (k - (n + 1) // 2))


import math
(n, k) = tuple(map(int, input().split()))
o = int(math.ceil(n / 2))
if k <= o:
	print(k * 2 - 1)
else:
	k = k - o
	print(k * 2)


from math import ceil
(n, k) = [int(x) for x in input().split()]
m = ceil(n / 2)
if k <= m:
	print(2 * k - 1)
else:
	k -= m
	if k == 0:
		print(k * 2 + 2)
	else:
		print(k * 2)


def evenOdds(n, k):
	mid = n // 2
	if n % 2 == 1:
		mid += 1
	if k <= mid:
		return 2 * k - 1
	k -= mid
	return 2 * k
[n, k] = [int(x) for x in input().split()]
print(evenOdds(n, k))


from math import ceil
X = list(map(int, input().split()))
print(X[1] * 2 - 1 if X[1] <= ceil(X[0] / 2) else (X[1] - ceil(X[0] / 2)) * 2)


(a, b) = map(int, input().split())
m = a // 2 + a % 2
if b <= m:
	c = 2 * b - 1
else:
	c = 2 * (b - m)
print(c)


line = input()
number = line.split()
x = int(number[0])
y = int(number[1])
answers = []
z = 1
if y * 2 - 1 <= x:
	print(y * 2 - 1)
elif x % 2 == 0:
	print(2 * (y - int(x / 2)))
else:
	print(2 * (y - int(x / 2) - 1))


(limit, place) = map(int, input().split())
ans = 0
lim = (limit + 1) // 2
if place > lim:
	ans = (place - lim) * 2
else:
	ans = 1 + 2 * (place - 1)
print(ans)


(n, k) = map(int, input().strip().split())
if n % 2 == 0:
	mitad = n - 1
	if n / 2 >= k:
		print(int(mitad - 2 * (n / 2 - k)))
	else:
		print(int(2 * (k - n / 2)))
else:
	mitad = n
	if (n + 1) / 2 >= k:
		print(int(mitad - 2 * ((n + 1) / 2 - k)))
	else:
		print(int(2 * (k - (n + 1) / 2)))


import sys
import math
inputs = sys.stdin.readline().split()
n = int(inputs[0])
k = int(inputs[1])
a = math.ceil(n / 2)
if k <= a:
	print(2 * k - 1)
else:
	k = k - a
	print(2 * k)


(x, y) = list(map(int, input().split()))
if y <= int((x + 1) / 2):
	ans = 2 * y - 1
	print(ans)
else:
	print(2 * (y - int((x + 1) / 2)))


from sys import stdin, stdout
from collections import defaultdict
import heapq
import math

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()
INF = 10000000000.0
mod = 1000000000.0 + 7
(n, k) = get_ints()
ans = 0
if k <= math.ceil(n / 2):
	ans = 1 + 2 * (k - 1)
else:
	k = k - math.ceil(n / 2)
	ans = 2 * k
print(ans)


Dat = input('')
Dat = Dat.split()
N = int(Dat[0])
K = int(Dat[1])
if N % 2 == 0:
	if K <= N // 2:
		print(2 * K - 1)
	else:
		print(2 * (K - N // 2))
elif K <= N // 2 + 1:
	print(2 * K - 1)
else:
	print(2 * (K - (N // 2 + 1)))


l = list(map(int, input().split()))
n = l[0]
k = l[1]
f = (n + 1) // 2
if k > f:
	print((k - f) * 2)
else:
	print(2 * k - 1)


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt

def binNumber(n, size=1):
	return bin(n)[2:].zfill(size)

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())
(n, m) = isp()
k = int(ceil(n / 2))
if m <= k:
	print(2 * m - 1)
else:
	print(2 * (m - k))


def cap(n, k):
	if k > (n + 1) // 2:
		return 2 * (k - (n + 1) // 2)
	return 2 * k - 1
(a, b) = tuple(map(int, input().split(' ')))
print(cap(a, b))


(n, k) = [int(t) for t in input().split()]
if n % 2 == 0:
	if k <= n / 2:
		print(2 * k - 1)
	else:
		print(2 * k - n)
if n % 2 == 1:
	if k <= (n + 1) / 2:
		print(2 * k - 1)
	else:
		print(2 * k - n - 1)


(n, k) = map(int, input().split())
mianeh = int((n + 1) / 2)
if k > mianeh:
	res = 2 * (k - mianeh)
else:
	res = 2 * k - 1
print(int(res))


import math
(x, y) = input().split()
(x, y) = (int(x), int(y))
if y <= math.ceil(x / 2):
	print(2 * y - 1)
else:
	t = math.ceil(x / 2)
	print(2 * (y - t))


foo = input()
n = int(foo.split()[0])
k = int(foo.split()[1])
if n % 2 != 0:
	n = n + 1
if n / k < 2:
	print(2 * k - n)
else:
	print(2 * k - 1)


nAndK = input().split(' ')
n = int(nAndK[0])
k = int(nAndK[1])
odds = (n + 1) // 2
evens = n // 2
if k <= odds:
	print(int(k * 2) - 1)
else:
	print(int((k - odds) * 2))


(n, k) = [int(i) for i in input().split()]
even = n // 2
odd = n - n // 2
c = 1
d = 0
if odd >= k:
	print(2 * k - 1)
else:
	print(2 * (k - odd))


from sys import stdin, stdout
from math import ceil
from collections import deque
inp = stdin.readline
out = stdout.write
(n, k) = map(int, inp().strip().split())
x = ceil(n / 2)
res = 0
if k > x:
	res = 2 + 2 * (k - (x + 1))
else:
	res = 1 + 2 * (k - 1)
out(str(res))


(n, k) = input().split()
n = int(n)
k = int(k)
half = int(n / 2)
oddHalf = half + 1
number = 0
if n % 2 == 0:
	if k <= half:
		number = k * 2 - 1
	else:
		number = 2 * (k - half)
elif k <= oddHalf:
	number = 2 * k - 1
else:
	number = 2 * (k - oddHalf)
print(number)


(n, k) = map(int, input().split())
m = 0 - -n // 2
print([2 * k - 1, (k - m) * 2][k > m])


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, k) = zz()
t = (n + 1) // 2
if k <= t:
	print(1 + (k - 1) * 2)
else:
	print(2 + (k - t - 1) * 2)


from math import ceil
a = list(map(int, input().split()))
mid = ceil(a[0] / 2)
if a[1] <= mid:
	print(a[1] + a[1] - 1)
elif a[0] % 2 != 0:
	print(a[1] - (a[0] - a[1]) - 1)
else:
	print(a[1] - (a[0] - a[1]))


def odd(a):
	return 2 * a + 1

def even(a):
	return 2 * a
(n, k) = map(int, input().strip().split(' '))
if n % 2 != 0:
	if k <= n // 2 + 1:
		print(odd(k - 1))
	else:
		print(even(k - n // 2 - 1))
elif k <= n // 2:
	print(odd(k - 1))
else:
	print(even(k - n // 2))


import math

def main():
	(num, pos) = input().split()
	(num, pos) = (int(num), int(pos))
	if pos <= math.ceil(num / 2):
		newNum = 1
		newNum += 2 * (pos - 1)
	else:
		newNum = 2
		pos -= math.ceil(num / 2)
		newNum += 2 * (pos - 1)
	print(newNum)
main()


from math import *
(n, k) = map(int, input().split())
i = 0
s = ceil(n / 2)
if k <= s:
	print(k + (k - 1))
else:
	print(2 * (k - s))


(n, k) = map(int, input().split())
j = abs(n // 2 - n)
if k <= j:
	print(2 * k - 1)
elif k > j:
	k -= j
	print(k * 2)


(n, k) = [int(a) for a in input().strip().split()]
if n % 2 == 0:
	if k <= n // 2:
		num = k
		print(num * 2 - 1)
	else:
		num = k - n // 2
		print(num * 2)
elif k <= n // 2 + 1:
	num = k
	print(num * 2 - 1)
else:
	num = k - (n // 2 + 1)
	print(num * 2)


import math
(x, y) = input().split()
x = int(x)
y = int(y)
even = 2
odd = 1
k = math.ceil(x / 2)
if k < y:
	print(2 * (y - k))
elif y == 1:
	print(1)
elif k > y and x % 2 == 0:
	print(x - (1 + 2 * (k - y)))
elif k == y and k % y == 0 and (x % 2 == 0):
	print(x - 1)
elif k == y and k % y == 0 and (x % 2 != 0):
	print(x)
elif x % 2 != 0:
	c = x + 1
	print(c - (1 + 2 * (k - y)))
else:
	print(1 + 2 * (k - y))


m = input().split()
n = int(m[0])
q = int(m[1])
if n % 2 == 0:
	if q <= n / 2:
		print(int(1 + (q - 1) * 2))
	else:
		r = q - n / 2
		print(int(2 + (r - 1) * 2))
elif q <= (n + 1) / 2:
	print(int(1 + (q - 1) * 2))
else:
	r = q - (n + 1) / 2
	print(int(2 + (r - 1) * 2))


l = list(map(int, input().strip().split()))
n = l[0]
k = l[1]
if n % 2 == 0:
	if n // 2 >= k:
		print(2 * k - 1)
	else:
		print(2 * (k - n // 2))
elif n // 2 + 1 >= k:
	print(2 * k - 1)
else:
	print(2 * (k - (n // 2 + 1)))


import sys
(n, k) = map(int, sys.stdin.readline().split())
if k <= (n + 1) // 2:
	sys.stdout.write(str(2 * k - 1))
else:
	sys.stdout.write(str(2 * (k - (n + 1) // 2)))


n = list(map(int, input().split()))
if n[0] % 2 == 0:
	pos = n[0] // 2
	if n[1] > pos:
		print((n[1] - pos) * 2)
	else:
		print(2 * n[1] - 1)
else:
	pos = n[0] // 2 + 1
	if n[1] > pos:
		print((n[1] - pos) * 2)
	else:
		print(2 * n[1] - 1)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
if n % 2 == 1:
	if k <= n // 2 + 1:
		print(2 * k - 1)
	elif k > n // 2 + 1:
		print(2 * (k - n // 2 - 1))
if n % 2 == 0:
	if k <= n // 2:
		print(2 * k - 1)
	elif k > n // 2:
		print(2 * (k - n // 2))


(a, b) = map(int, input().split())
if a % 2 == 0:
	mid = a // 2
else:
	mid = a // 2 + 1
if b <= mid:
	print(2 * b - 1)
else:
	print(2 * (b - mid))


import math
(n, t) = map(int, input().split())
mid = math.ceil(n / 2)
if t > mid:
	print((t - mid) * 2)
else:
	print((t - 1) * 2 + 1)


def get_digit(n, k):
	ocount = 0
	ecount = 0
	if n & 1 == 1:
		ocount = n // 2 + 1
	else:
		ocount = n // 2
	ecount = n - ocount
	if k <= ocount:
		return k + (k - 1)
	else:
		y = k - ocount
		return 2 * y
(n, k) = map(int, input().strip().split(' '))
print(get_digit(n, k))


(n, m) = map(int, input().split())
if m <= (n + 1) // 2:
	x = m * 2 - 1
	print(x)
else:
	x = (m - (n + 1) // 2) * 2
	print(x)


(n, d) = list(map(int, input().split()))
if n % 2 == 1 and d == n // 2 + 1:
	print(n)
elif n == d:
	if n == 10 ** 12:
		print(n)
	else:
		print(n - 1)
elif d <= n // 2:
	print(d * 2 - 1)
else:
	if n % 2 == 1:
		d = d - 1
	f = n // 2
	d = d - f
	print(d * 2)


(N, A) = map(int, input().split())
(odd, even) = ((N + 1) // 2, N // 2)
if A <= odd:
	print(A * 2 - 1)
else:
	print((A - odd) * 2)


till_and_point = input().split()
till = int(till_and_point[0])
point = int(till_and_point[1])
oddnumbers = till // 2
if till % 2:
	oddnumbers += 1
if point <= oddnumbers:
	number = point * 2 - 1
else:
	number = (point - oddnumbers) * 2
print(number)


import math
(x, y) = [int(x) for x in input('').split()]
n = math.ceil(x / 2)
if y > n:
	y = y - n
	print(y * 2)
else:
	print(2 * y - 1)


(nnn, kkk) = map(int, input().split())
if kkk <= (nnn + 1) // 2:
	print(kkk * 2 - 1)
else:
	print((kkk - (nnn + 1) // 2) * 2)


def main():
	l = list()
	l = input()
	l = l.split()
	l[0] = int(l[0])
	l[1] = int(l[1])
	count = 1
	if l[1] <= (l[0] + 1) / 2:
		print(l[1] * 2 - 1)
	else:
		print((l[1] - (l[0] + 1) // 2) * 2)
main()


nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
evens = n // 2
odds = n // 2 if n % 2 == 0 else n // 2 + 1
res = 0
if k <= odds:
	res = 2 * k - 1
else:
	res = 2 * (k - odds)
print(res)


import math
inputList = input().split()
n = int(inputList[0])
k = int(inputList[1])
even = int(n / 2)
odd = int(math.ceil(n / 2))
if k <= odd:
	print(k * 2 - 1)
else:
	print((k - odd) * 2)


import math
(a, b) = [int(i) for i in input().split()]
if a % 2 == 0:
	if b <= a // 2:
		print(1 + 2 * (b - 1))
	else:
		print(2 * (b - a // 2))
elif b <= math.ceil(a / 2):
	print(1 + 2 * (b - 1))
else:
	print(2 * (b - (a // 2 + 1)))


inp = input().split()
(n, k) = (int(inp[0]), int(inp[1]))
mid = n // 2 + n % 2
if k <= mid:
	ans = 2 * k - 1
else:
	k -= mid
	ans = 2 * k
print(ans)


__author__ = 'runekri3'
(n, k) = list(map(int, input().split()))
first_odd_num = (n + 1) // 2
if k > first_odd_num:
	print((k - first_odd_num) * 2)
else:
	print(k * 2 - 1)


def solve(n, k):
	mod = n % 2
	mid = n // 2 + mod
	if k > mid:
		k -= mid
		return 2 * k
	else:
		return 2 * (k - 1) + 1
(n, k) = map(int, input().split())
print(solve(n, k))


import math

def f():
	(x, y) = map(int, input().split())
	mid = math.ceil(x / 2)
	mid = int(mid)
	if y <= mid:
		print(y * 2 - 1)
	else:
		print((y - mid) * 2)
f()


import math
nk = list(map(str, input().split()))
n = int(nk[0])
k = int(nk[1])
if math.ceil(n / 2) > k:
	print(k * 2 - 1)
elif math.ceil(n / 2) < k:
	print((k - math.ceil(n / 2)) * 2)
elif n % 2 == 0:
	print(n - 1)
else:
	print(n)


(a, b) = map(int, input().split())
mid = a + 1 >> 1
if b <= mid:
	print((b << 1) - 1)
else:
	print(b - mid << 1)


l = input().split()
l = [int(x) for x in l[:]]
n = l[0]
k = l[1]
if n == 1:
	print(1)
elif n == 2:
	print(k)
else:
	half = n // 2
	if n & 1:
		half += 1
	if k <= half:
		print(2 * k - 1)
	else:
		print(2 * (k - half))


(x, y) = map(int, input().split())
if x % 2 == 0:
	if y <= x // 2:
		print(2 * y - 1)
		exit()
	if y > x // 2:
		print(2 * y - x)
		exit()
if x % 2 != 0:
	if y <= x // 2 + 1:
		print(2 * y - 1)
		exit()
	if y > x // 2:
		print(2 * y - (x + 1))
		exit()


n = input().split()
k = int(n[1])
n = int(n[0])
result = 0
t = (n + 1) // 2
if k > t:
	print((k - t) * 2)
else:
	print(k * 2 - 1)


a = input().split(' ')
num = int(a[0])
pos = int(a[1])
if num % 2 == 0:
	sec = num / 2
	if pos <= sec:
		print(int(pos * 2 - 1))
	else:
		print(int(2 * (pos - sec)))
else:
	sec = (num + 1) / 2
	if pos <= sec:
		print(int(pos * 2 - 1))
	else:
		print(int(2 * (pos - sec)))


(n, k) = map(int, input().split())
if n % 2 == 0:
	d = n // 2
else:
	d = n // 2 + 1
if k <= d:
	s = k * 2 - 1
else:
	s = (k - d) * 2
print(s)


(n, k) = map(int, input().split())
lenfirst = (n + n % 2) / 2
if k <= lenfirst:
	print((k - 1) * 2 + 1)
else:
	print(int(k - lenfirst) * 2)


def ceiling(a):
	if a > int(a):
		return int(a + 1)
	return int(a)
(n, k) = [int(x) for x in input().split()]
if k <= ceiling(n / 2):
	print(2 * (k - 1) + 1)
elif k > ceiling(n / 2):
	print(2 * (k - ceiling(n / 2)))


line = list(map(int, input().split(' ')))
n = line[0]
k = line[1]
if k <= (n + int('1')) / int('2'):
	print(int(k * int('2') - int('1')))
else:
	res = n + int('1')
	res = int(res) / int('2')
	res = k - int(res)
	res = int(res) * 2
	print(res)


(n, k) = tuple(map(int, input().split()))
if k <= n - n // 2:
	print(2 * k - 1)
else:
	print(2 * (k - n + n // 2))


import math

def sumofno(n):
	summ = 0
	while n > 0:
		summ += n % 10
		n //= 10
	return summ

def get_key(val, lis):
	for (key, value) in lis.items():
		if value == val:
			return key

def isprime(val):
	c = 0
	for j in range(2, val):
		if val % j == 0:
			return False
	return True

def toh(n, b, a, e):
	if n >= 1:
		toh(n - 1, b, e, a)
		print(str(b) + ' to ' + str(e))
		toh(n - 1, a, b, e)

def gcd(a, b):
	if a == b:
		return a
	if a % b == 0 or b % a == 0:
		return min(a, b)
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)
try:
	ans = []
	for i in range(1):
		(n, k) = input().split()
		n = int(n)
		k = int(k)
		if n % 2 == 0:
			no = n // 2
			ne = n // 2
		else:
			no = n // 2 + 1
			ne = n // 2
		if k <= no:
			ans.append(2 * k - 1)
		else:
			k = k - no
			ans.append(2 * k)
	for an in ans:
		print(an)
except:
	pass


x = [int(b) for b in input().split()]
if x[1] <= x[0] // 2 + x[0] % 2:
	print(range(1, x[0] + 1, 2)[x[1] - 1])
else:
	print(range(2, x[0] + 1, 2)[x[1] - x[0] // 2 - x[0] % 2 - 1])


from math import ceil, floor
(n, k) = map(int, input().split())
odd = floor(n / 2)
even = ceil(n / 2)
if n & 1:
	odd = ceil(n / 2)
	even = floor(n / 2)
print(2 * (k - odd) if k > odd else 2 * k - 1)


import math
(n, k) = map(int, input().split())
m = math.ceil(n / 2)
if k <= m:
	ans = k + (k - 1)
else:
	p = k - m
	ans = 2 * p
print(ans)


(n, k) = [int(c) for c in input().split()]
if n % 2 == 1:
	number_odd = int(n / 2) + 1
	number_even = int(n / 2)
else:
	number_odd = int(n / 2)
	number_even = int(n / 2)
if k > number_odd:
	neu_k = k - number_odd
	number = neu_k * 2
else:
	number = k * 2 - 1
print(number)


(n, p) = [int(x) for x in input().split()]
odd = int((n + 1) / 2)
if p <= odd:
	print(2 * p - 1)
else:
	print(2 * (p - odd))


(n, k) = [int(v) for v in input().split()]
if n % 2 == 1:
	if k <= (n + 1) / 2:
		print(2 * k - 1)
	else:
		print(2 * k - n - 1)
elif k <= n / 2:
	print(2 * k - 1)
else:
	print(2 * k - n)


(n, k) = map(int, input().split())
border = n // 2
if n % 2 == 1:
	border = n // 2 + 1
if k > border:
	print((k - border) * 2)
else:
	print(2 * k - 1)


(n, p) = map(int, input().split())
if p - (n + 1) // 2 > 0:
	number = (p - (n + 1) // 2) * 2
else:
	number = p * 2 - 1
print(number)


a = input().split()
firstArr = [int(x) for x in a]
(n, k) = firstArr
if k > (n + 1) / 2:
	if n % 2 == 1:
		n += 1
	k -= n / 2
	print(int(k * 2))
else:
	print(k * 2 - 1)


import math
(n, k) = map(int, input().split())
a = []
flag = False
if n % 2 != 0:
	n += 1
	flag = True
if n // 2 >= k:
	print(k * 2 - 1)
elif n == k:
	print(n)
elif flag == False:
	if k >= 10:
		print((k - n // 2) * 2)
	else:
		print(math.floor(k // 2 - 1) * 2)
else:
	print((k - math.floor(n // 2)) * 2)


import math
n = list(map(int, input().split()))
if n[1] <= math.ceil(n[0] / 2):
	res = n[1] * 2 - 1
else:
	res = (n[1] - math.ceil(n[0] / 2)) * 2
print(res)


(counter, n) = map(int, input().split())
if counter % 2 == 0:
	odd_count = even_count = counter // 2
else:
	odd_count = counter // 2 + 1
	even_count = counter - odd_count
if n <= odd_count:
	print(2 * n - 1)
else:
	n = n - odd_count
	print(2 * n)


(n, k) = [int(x) for x in input().split()]
if n % 2 == 0:
	(maxOddIndex, maxEvenIndex) = (int(n / 2), int(n / 2) * 2)
	maxOddValue = n - 1
else:
	maxOddIndex = int(n / 2) + 1
	maxEvenIndex = int(n / 2) + maxOddIndex
	maxOddValue = n
maxEvenValue = int(n / 2) * 2
if k > maxOddIndex:
	print(maxEvenValue - (maxEvenIndex - k) * 2)
else:
	print(maxOddValue - (maxOddIndex - k) * 2)


from math import ceil
(a, b) = map(int, input().split())
if b <= ceil(a / 2):
	print(2 * b - 1)
elif a % 2 != 0:
	print(int(2 * (b - ceil(a / 2))))
else:
	print(2 * (b - a // 2))


def build_kth_even_number(k, n):
	if n % 2 == 1:
		k -= 1
	return 2 * k

def build_kth_odd_number(k):
	return 2 * k - 1
line = input().split()
n = int(line[0])
k = int(line[1])
if k <= n // 2 or (n % 2 == 1 and k <= n // 2 + 1):
	print(build_kth_odd_number(k))
else:
	print(build_kth_even_number(k - n // 2, n))


(n, k) = list(map(int, input().split()))
d = n + 1 >> 1
print((k * 2 - 1, (k - d) * 2)[k > d])


import math
string = input()
arr = string.split(' ')
n = int(arr[0])
i = int(arr[1])
mid = int(math.ceil(n / 2))
if i <= mid:
	result = (i - 1) * 2 + 1
else:
	result = (i - mid) * 2
print(result)


(n, k) = map(int, input().split())
cnt_odd = (n + 1) // 2
if k <= cnt_odd:
	print(2 * k - 1)
else:
	print(2 * (k - cnt_odd))


(a, b) = map(int, input().split())
c = b - (a + 1) // 2
print([2 * b - 1, 2 * c][c > 0])


import math
(n, k) = [int(x) for x in input().split()]
a = math.ceil(n / 2)
if k <= a:
	print(2 * k - 1)
if k > a:
	print(2 * (k - a))


(number, position) = map(int, input().split())
element = 0
number_even = number // 2
number_odd = number - number_even
if position != 1:
	if position <= number_odd:
		element = position + (position - 1)
		print(element)
	elif position > number_odd:
		element = (position - number_odd) * 2
		print(element)
else:
	print(position)


def nthOdd(n):
	return int(1 + (n - 1) * 2)

def nthEven(n):
	return int(2 + (n - 1) * 2)
arr = list(map(int, input().split()))
n = arr[0]
k = arr[1]
if n % 2 == 0:
	if k <= n / 2:
		print(nthOdd(k))
	else:
		print(nthEven(k - n / 2))
elif k <= (n + 1) / 2:
	print(nthOdd(k))
else:
	print(nthEven(k - (n + 1) / 2))


import math
(a, b) = map(int, input().split())
x = a / 2
x = math.ceil(x)
if b <= x:
	l = 2 * b - 1
else:
	l = 2 * (b - x)
print(l)


import math
(n, k) = map(int, input().split())
if n & 1:
	(odd, even) = (math.ceil(n / 2), n // 2)
else:
	(odd, even) = (n // 2, n // 2)
d = 2
if k <= odd:
	a = 1
	ans = a + (k - 1) * d
else:
	a = 2
	k = abs(abs(n - even) - k)
	ans = a + (k - 1) * d
print(ans)


from math import ceil
(n, k) = [int(i) for i in input().split()]
m = ceil(n / 2)
if k > m:
	print((k - m) * 2)
elif k <= m:
	print(1 + (k - 1) * 2)


m = input()
z = m.split()
n = int(z[0])
k = int(z[1])
if n % 2 == 1:
	n += 1
mid = n / 2
if k <= mid:
	ans = k * 2 - 1
else:
	k = k - mid
	ans = k * 2
print(int(ans))


num_test = input()
num_test = num_test.split()
n = int(num_test[0])
k = int(num_test[1])
a = 0
if n % 2 == 0:
	if k <= n / 2:
		a = 2 * (k - 1) + 1
		print(int(a))
	else:
		a = (k - n / 2) * 2
		print(int(a))
elif k <= (n + 1) / 2:
	a = 2 * (k - 1) + 1
	print(int(a))
else:
	a = (k - (n + 1) / 2) * 2
	print(int(a))


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	(N, K) = getInts()
	if N % 2 == 1:
		N += 1
	if K <= N // 2:
		return 2 * K - 1
	K -= N // 2
	return 2 * K
ans = solve()
print(ans)


(a, b) = map(int, input().strip().split())
if a % 2 == 0:
	m = a // 2
else:
	m = a // 2 + 1
if b > m:
	print((b - m) * 2)
elif b < m:
	if a % 2 == 0:
		print(a - 1 - (m - b) * 2)
	else:
		print(a - (m - b) * 2)
elif b == m:
	if a % 2 == 0:
		print(a - 1)
	else:
		print(a)


k = input()
a = k.split(' ')
odd_len = 0
eve_len = 0
if int(a[0]) % 2 == 0:
	odd_len = int(a[0]) // 2
	eve_len = int(a[0]) // 2
else:
	odd_len = int(a[0]) // 2 + 1
	eve_len = int(a[0]) // 2
out = 0
if int(a[1]) <= odd_len:
	b = int(a[1]) - 1
	out = 1 + b * 2
else:
	b = int(a[1]) - odd_len - 1
	out = 2 + b * 2
print(out)


(a, k) = input().strip().split(' ')
(a, k) = [int(a), int(k)]
if a % 2:
	p = a // 2 + 1
	x = k - p
	if x <= 0:
		print(k * 2 - 1)
	else:
		print((k - p) * 2)
else:
	p = a // 2
	x = k - p
	if x <= 0:
		print(k * 2 - 1)
	else:
		print((k - p) * 2)


np = input().split()
(n, p) = (int(np[0]), int(np[1]))
if p <= (n + 1) / 2:
	print(2 * p - 1)
else:
	print((p - (n + 1) // 2) * 2)


from math import ceil
(n, k) = map(int, input().split())
no = int(ceil(n / 2))
ne = n - no
if k <= no:
	print(2 * k - 1)
else:
	k -= no
	print(2 * k)


import math
(n, k) = list(map(int, input().split()))
mi = 0
a = []
if n % 2 == 0:
	mi = n // 2 - 1
else:
	mi = n // 2
if k - 1 <= mi:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - 1 - mi))


original_string_input = input()
splitting_original_string = original_string_input.split(' ')
upper_limit = int(splitting_original_string[0])
number_to_find = int(splitting_original_string[1])
if upper_limit % 2 == 0:
	number_of_odd_numbers = number_of_even_numbers = int(upper_limit / 2)
else:
	number_of_even_numbers = int(upper_limit / 2)
	number_of_odd_numbers = number_of_even_numbers + 1
if number_to_find <= number_of_odd_numbers:
	multiplier_needed = number_to_find - 1
	final_number = 2 * multiplier_needed + 1
else:
	multiplier_needed = number_to_find - number_of_odd_numbers
	final_number = 2 * multiplier_needed
print(final_number)


m = input().split()
n = int(m[0])
k = int(m[1])
half = n // 2
if n % 2 != 0:
	half += 1
ans = 0
if k <= half:
	ans = 2 * k - 1
else:
	ans = 2 * (k - half)
print(ans)


(n, k) = map(int, input().split())
if n % 2 == 0:
	moddho_number = int(n / 2)
	if k <= moddho_number:
		parthokko = moddho_number - k
		print(n - 1 - parthokko * 2)
	else:
		dif = n - k
		print(n - dif * 2)
else:
	moddho_number = int(n / 2 + 1)
	if k <= moddho_number:
		parthokko = moddho_number - k
		print(n - parthokko * 2)
	else:
		dif = n - k
		print(n - 1 - dif * 2)


def ceil(a):
	if a == int(a):
		return a
	else:
		return int(a + 1)
(n, k) = map(int, input().split())
if k <= ceil(n / 2):
	print(int(2 * (k - 1) + 1))
else:
	k -= ceil(n / 2)
	print(int(2 * k))


import math

def even_odds(n, k):
	half = math.ceil(n / 2)
	if k <= half:
		return 2 * k - 1
	k = k - half
	return 2 * k
(n, k) = map(int, input().rstrip().split())
print(even_odds(n, k))


(n, k) = (int(i) for i in input().split())
o = (n + 1) // 2
e = n // 2
if k <= o:
	print(2 * k - 1)
else:
	if n % 2 == 1:
		print(2 * (k - e - 1))
	if n % 2 == 0:
		print(2 * (k - e))


def main():
	inp = input().split()
	(n, k) = (int(inp[0]), int(inp[1]))
	if n == k and n == 1:
		print(1)
	else:
		print(k * 2 - 1 if k <= n // 2 else (k - n // 2) * 2) if n % 2 == 0 else print(k * 2 - 1 if k <= n // 2 + 1 else (k - n // 2 - 1) * 2)
main()


import math
(n, k) = [int(n) for n in input().split()]
odd = math.ceil(n / 2)
if k <= odd:
	l = k * 2 - 1
else:
	l = (k - odd) * 2
print(l)


def main():
	(n, k) = [int(i) for i in input().split()]
	if n % 2 == 0:
		oddUp = int(n / 2)
	else:
		oddUp = int((n + 1) / 2)
	if k <= oddUp:
		print(2 * k - 1)
	else:
		print(2 * (k - oddUp))
main()


(n, k) = map(int, input().split())
div1 = n // 2 + n % 2
div2 = n - div1
if k <= div1:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - div1 - 1) + 2)


from math import ceil

def odds():
	(n, k) = list(map(int, input().split()))
	odds = ceil(n / 2)
	if k <= ceil(n / 2):
		print(2 * k - 1)
	else:
		print(2 * (k - odds))
odds()


from math import ceil

def mCheckInputs(inputList):
	input1 = inputList[0]
	input2 = inputList[1]
	if (input1.isdigit() and input2.isdigit()) and 1 <= int(input2) <= int(input1) <= pow(10, 12):
		pass
	else:
		exit(1)

def mHandleInputs(inputList):
	try:
		(x, k) = input().split()
		inputList.extend([x, k])
		mCheckInputs(inputList)
	except ValueError as e:
		exit(1)

def mDoWork(inputList, outputList):
	k = int(inputList.pop())
	n = int(inputList.pop())
	oddCount = n // 2 if n % 2 == 0 else ceil(n / 2)
	evenCount = n - oddCount
	if k <= oddCount:
		result = 2 * k - 1
	else:
		result = 2 * (k - oddCount)
	outputList.append(result)

def mFormatResult(outputList):
	print(outputList[0])

def main():
	inputList = []
	mHandleInputs(inputList)
	outputList = []
	mDoWork(inputList, outputList)
	mFormatResult(outputList)
main()


(n, k) = input().split(' ')
(n, k) = (int(n), int(k))
s = n // 2 + n % 2
if k > s:
	k = k - s
	print(2 * k)
else:
	print(2 * k - 1)


(number, pos) = map(int, input().strip().split())
if pos <= int((number + 1) / 2):
	print(int(pos * 2 - 1))
else:
	print(int((pos - int((number + 1) / 2)) * 2))


(n, k) = map(int, input().split())
middle = int(n / 2)
sub = 0
if n % 2 == 1:
	sub = 1
if k <= middle + sub:
	print(k * 2 - 1)
else:
	print(int((k - middle - sub) * 2))


import sys
n = sys.stdin.read()
a = n.split()
n = int(a[0])
k = int(a[1])
if k <= (n + 1) // 2:
	print(2 * k - 1)
else:
	print((k - (n + 1) // 2) * 2)


from sys import stdin
(n, k) = [int(x) for x in stdin.readline().rstrip().split()]
h = n // 2 + n % 2
print((1 + 2 * (k - 1), 2 * (k - h))[k > h])


import sys
import math
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, k) = map(int, input().split())
(odds, evens) = ((n + 1) // 2, n // 2)
if k <= odds:
	print(int(k * 2) - 1)
else:
	print(int((k - odds) * 2))


s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
if a[0] % 2 == 0:
	b = int(a[0] / 2)
	if a[1] <= b:
		print((a[1] - 1) * 2 + 1)
	else:
		print((a[1] - b) * 2)
else:
	b = int(a[0] / 2) + 1
	if a[1] <= b:
		print((a[1] - 1) * 2 + 1)
	else:
		print((a[1] - b) * 2)


[num, solution] = input().split(' ')
if int(num) % 2 == 0:
	number_of_odd = int(num) / 2
else:
	number_of_odd = (int(num) + 1) / 2
if int(solution) > number_of_odd:
	print(int((int(solution) - number_of_odd) * 2))
else:
	print(int(solution) * 2 - 1)


from sys import stdin, stdout
(n, k) = map(int, input().split())
if n % 2 == 1:
	n += 1
if k <= n / 2:
	print(2 * k - 1)
else:
	print(2 * k - n)


a = input().split(' ')
n = int(a[0])
x = int(a[1])
if n % 2 == 0:
	if x <= n / 2:
		ans = x * 2 - 1
	else:
		ans = (x - n / 2) * 2
elif x <= (n + 1) / 2:
	ans = x * 2 - 1
else:
	ans = (x - (n + 1) / 2) * 2
print(int(ans))


(n, k) = [int(elem) for elem in input().split()]
odd = (n + 1) // 2
if odd >= k:
	print(2 * k - 1)
else:
	print(2 * (k - odd))


str = input().split()
(n, k) = (int(str[0]), int(str[1]))
even_nums_count = n // 2 + n % 2
if k <= even_nums_count:
	print(2 * k - 1)
else:
	print(2 * (k - even_nums_count))


def solve():
	(n, k) = map(int, input().strip().split())
	numOdd = (n + 1) // 2
	if k <= numOdd:
		print(1 + (k - 1) * 2)
	else:
		k -= numOdd
		print(2 + (k - 1) * 2)
solve()


(n, k) = map(int, input().split())
half = n // 2
if n % 2 == 1:
	half = n // 2 + 1
is_odd = True
index = k
if k > half:
	is_odd = False
	index = k - half
if is_odd:
	print(str(index * 2 - 1))
else:
	print(str(index * 2))


import math
(n, k) = list(map(int, input().split()))
mid = int(math.ceil(n / 2))
if k <= mid:
	ans = 1 + 2 * (k - 1)
else:
	ans = 2 * (k - mid)
print(ans)


(j, k) = map(int, input().split())
en = 0
on = 0
if j % 2 == 0:
	(en, on) = (j // 2, j // 2)
else:
	en = (j - 1) // 2
	on = (j + 1) // 2
if k > on:
	print(2 * (k - on))
else:
	print(2 * k - 1)


(a, b) = input().split()
a = int(a, 10)
b = int(b, 10)
k = int(a / 2)
if k * 2 != a:
	k = k + 1
if b <= k:
	print(b * 2 - 1)
else:
	k = b - k
	print(2 * k)


(num, pos) = [int(x) for x in input().split()]
evenside = num // 2
oddside = num - evenside
if oddside >= pos:
	flag = 1
else:
	flag = 0
if flag == 1:
	result = 1 + (pos - 1) * 2
else:
	result = 2 + (pos - oddside - 1) * 2
print(result)


import math
[m, n] = [int(n) for n in input().split()]
if n <= math.ceil(m / 2):
	print(2 * n - 1)
else:
	print(2 * (n - math.ceil(m / 2)))


def evenOdds():
	s = [int(x) for x in input().split()]
	n = s[0]
	k = s[1]
	if n % 2 == 0:
		if k > n / 2:
			print(k - (n - k))
		elif k <= n / 2:
			print(k + (k - 1))
	elif k > n // 2 + 1:
		print(k - (n - (k - 1)))
	elif k <= n // 2 + 1:
		print(k + (k - 1))
evenOdds()


import math
(n, k) = [int(x) for x in input().split()]
lenOdds = math.ceil(n / 2)
lenEvens = math.floor(n / 2)
if k > lenOdds:
	print((k - lenOdds) * 2)
else:
	print(k * 2 - 1)


p = input().split()
n = int(p[0])
k = int(p[1])
if n % 2 == 0:
	if k <= n // 2:
		print(1 + (k - 1) * 2)
	else:
		q = k - n // 2
		print(2 + (q - 1) * 2)
elif k <= (n + 1) // 2:
	print(1 + (k - 1) * 2)
else:
	q = k - (n + 1) // 2
	print(2 + (q - 1) * 2)


(max_number, lookup_pos) = map(int, input().split())
max_number += max_number % 2
if lookup_pos * 2 > max_number:
	print(max_number - (max_number - lookup_pos) * 2)
else:
	print(lookup_pos * 2 - 1)


(n, k) = map(int, input().split())
if n % 2 == 0:
	oddLen = (n - 1 - 1) / 2 + 1
else:
	oddLen = (n - 1) / 2 + 1
if k <= oddLen:
	result = 1 + 2 * (k - 1)
else:
	result = 2 + 2 * (k - oddLen - 1)
print(int(result))


import math
(hm, ind) = input().split(' ')
hm = int(hm)
ind = int(ind)
mid = math.ceil(hm / 2)
if ind <= mid:
	print(1 + (ind - 1) * 2)
else:
	add = ind - mid
	print(2 + (add - 1) * 2)


import math
line = input().split()
n = int(line[0])
k = int(line[1])
m = math.ceil(n / 2)
if k <= m:
	N = 2 * k - 1
else:
	N = 2 * (k - m)
print(N)


from collections import *
from math import *
from sys import *
(n, m) = map(int, input().split())
if m <= ceil(n / 2):
	print(2 * m - 1)
else:
	print(2 * (m - ceil(n / 2)))


def main():
	(n, k) = [int(i) for i in input().split(' ')]
	thresh = n // 2 + (n % 2 != 0)
	ans = 1 + (k > thresh) + 2 * (k - 1 - thresh * (k > thresh))
	print(ans)
main()


from math import *
(n, m) = map(int, input().split())
half = ceil(n / 2)
if m <= half:
	res = 1 + (m - 1) * 2
else:
	res = (m - half) * 2
print(res)


(a, b) = map(int, input().split())
numeven = int(a / 2)
numodd = a - numeven
f = 2
if b <= numodd:
	print(1 + 2 * (b - 1))
else:
	print(2 + 2 * (b - numodd - 1))


(a, b) = input().split()
a = int(a)
b = int(b)
if b <= (a + 1) / 2:
	z = 2 * b - 1
else:
	z = 2 * b - 1 - a + (a + 1) % 2
print(z)


import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
(n, k) = invr()
res = 0
if n % 2 == 0:
	if k > n // 2:
		res = 2 * k - n
	else:
		res = (k - 1) * 2 + 1
elif k > n // 2 + 1:
	res = 2 * k - n - 1
else:
	res = (k - 1) * 2 + 1
print(res)


s = str(input())
l = s.split()
n = int(l[0])
k = int(l[1])
if n % 2 == 0:
	z = int(n / 2)
	if z >= k:
		x = 2 * (k - 1) + 1
	else:
		x = 2 * (k - z)
else:
	z = int((n - 1) / 2 + 1)
	if z >= k:
		x = 2 * (k - 1) + 1
	else:
		x = 2 * (k - z)
print(x)


def even_odds():
	inp = input().split(' ')
	(total_nums, num_to_find) = (int(inp[0]), int(inp[1]))
	mid = (total_nums + 1) // 2
	if num_to_find > mid:
		return (num_to_find - mid) * 2
	else:
		return num_to_find * 2 - 1
print(even_odds())


(n, t) = map(int, input().split())
if n % 2 == 0:
	l1 = n // 2
	l2 = n // 2
	if t <= l1:
		print(2 * t - 1)
	else:
		print(2 * (t - l1))
else:
	l1 = n // 2 + 1
	l2 = n // 2
	if t <= l1:
		print(2 * t - 1)
	else:
		print(2 * (t - l1))


(n, k) = [int(x) for x in input().split()]
seq = []
evenNum = int(n / 2)
oddNum = n - evenNum
if k <= oddNum:
	print(1 + (k - 1) * 2)
else:
	k -= oddNum
	print(2 + (k - 1) * 2)


(n, k) = map(int, input().split())
s1 = (n + 1) // 2
s2 = n - s1
if k <= s1:
	print(k * 2 - 1)
else:
	print((k - s1) * 2)


(n, k) = map(int, input().split())
size = (n + 1) // 2
if k <= size:
	print(1 + (k - 1) * 2)
else:
	k -= size
	print(2 + (k - 1) * 2)


(n, k) = map(int, input().split())
numpos = -1
if k == 1:
	print(1)
elif n == 2 and k == 2:
	print(2)
else:
	half = -1
	if n % 2 == 0:
		half = n / 2
		if k <= half:
			numpos = k + (k - 1)
		else:
			numpos = (k - half) * 2
	else:
		half = n // 2 + 1
		if k <= half:
			numpos = k + (k - 1)
		else:
			numpos = (k - half) * 2
	print(int(numpos))


__author__ = 'myduomilia'
(n, k) = list(map(int, input().split()))
if k <= n // 2 + (1 if n % 2 != 0 else 0):
	print(2 * k - 1)
else:
	print(2 * k - n - (1 if n % 2 != 0 else 0))


import math
(n, k) = map(int, input().split())
half = math.ceil(n / 2)
if k <= half:
	answer = 2 * k - 1
else:
	answer = 2 * (k - half)
print(answer)


(a, b) = [int(i) for i in input().split()]
o = a // 2 + a % 2
if b <= o:
	print(2 * b - 1)
else:
	print(2 * (b - o))


inp = input().split()
n = int(inp[0])
k = int(inp[1])
if n % 2 == 0:
	ol = n // 2
else:
	ol = n // 2 + 1
if k > ol:
	print((k - ol) * 2)
else:
	print(k * 2 - 1)


t = input().split(' ')
k = int(int(t[0]) / 2 if int(t[0]) % 2 == 0 else (int(t[0]) + 1) / 2)
print(2 * (int(t[1]) - k) if int(t[1]) > k else 2 * int(t[1]) - 1)


import sys

def main(n, k):
	if n % 2 == 0:
		if k <= n / 2:
			return 2 * k - 1
		else:
			return (k - n // 2) * 2
	elif k <= n // 2 + 1:
		return 2 * k - 1
	else:
		return (k - n // 2 - 1) * 2
for (e, line) in enumerate(sys.stdin.readlines()):
	(n, k) = list(map(int, line.strip().split()))
print(main(n, k))


import math
args = [int(arg) for arg in input().strip().split(' ')]
(n, k) = (args[0], args[1])
mid = math.ceil(n / 2)
if k <= mid:
	print(2 * k - 1)
else:
	print(2 * (k - mid))


import math as y
(n, k) = map(int, input().split())
if k <= y.ceil(n / 2):
	print(2 * k - 1)
else:
	print(2 * (k - y.ceil(n / 2)))


(a, b) = map(int, input().split())
if a % 2 == 0 and b <= a // 2 or (a % 2 != 0 and b <= a // 2 + 1):
	print(2 * (b - 1) + 1)
else:
	print(2 * (b - (a - 1 - a // 2) - 1))


line = input().split(' ')
a = int(line[0])
b = int(line[1])
result = 0
odds = 0
evens = 0
if a % 2 == 0:
	odds = int(a / 2)
	evens = odds
else:
	evens = int((a - 1) / 2)
	odds = evens + 1
if b <= odds:
	result = 2 * b - 1
else:
	result = (b - odds) * 2
print(result)


from math import ceil
(n, k) = map(int, input().split())
s = ceil(n / 2)
if s >= k:
	num = 2 * k - 1
	print(num)
else:
	num = (k - s) * 2
	print(num)


(a, b) = map(int, input().split())
s = ''
s1 = ''
f = (a + 1) // 2
if f >= b:
	print(b * 2 - 1)
else:
	print((b - (a + 1) // 2) * 2)


import math
(n, k) = map(int, input().split())
l = list()
if k > (n + 1) / 2:
	a = (k - math.floor((n + 1) / 2)) * 2
else:
	a = 2 * k - 1
print(a)


(x, y) = map(int, input().split(' '))
if abs(-x // 2) >= y:
	print(2 * y - 1)
else:
	y = y - abs(-x // 2)
	print(2 * y)


(n, k) = map(int, input().split())
if n % 2:
	flag = n // 2 + 1
else:
	flag = n // 2
if k <= flag:
	print(k * 2 - 1)
else:
	print((k - flag) * 2)


(n, k) = map(int, input().split())
import math as m
a = m.ceil(n / 2)
if k > a:
	print(2 * (k - a))
else:
	print(2 * k - 1)


(n, k) = [int(x) for x in input().split()]

def even_odds(n, k):
	if n % 2 == 0:
		if k > n // 2:
			return 2 * (k - n // 2)
		else:
			return 2 * k - 1
	elif k > n // 2 + 1:
		return 2 * (k - n // 2 - 1)
	else:
		return 2 * k - 1
print(even_odds(n, k))


import math
(n, k) = map(int, input().split())
z = math.ceil(n / 2)
if k <= z:
	x = 2 * k - 1
	print(x)
elif k > z:
	y = k - z
	print(2 * y)


from math import ceil
line = input().split()
n = int(line[0])
k = int(line[1])
if k > ceil(n / 2):
	print(2 * (k - ceil(n / 2)))
else:
	print(2 * k - 1)


(total, n) = map(int, input().split())
if total % 2 == 0 and n <= total // 2:
	print(n * 2 - 1)
elif total % 2 != 0 and n <= total // 2 + 1:
	print(n * 2 - 1)
elif total % 2 == 0:
	print((n - total // 2) * 2)
else:
	print((n - total // 2 - 1) * 2)


(n, m) = map(int, input().split())
if n % 2 == 0:
	middle = n // 2
else:
	middle = n // 2 + 1
diff = m - middle
print([2 * m - 1, 2 * diff][middle < m])


import math
import os
import sys
import re
import string
import itertools
import functools
import operator
(n, k) = map(int, input().split())
l = (n + 1) // 2
if k <= l:
	print(2 * k - 1)
else:
	print(2 * (k - l))


import math
(a, b) = [int(x) for x in input().split()]
d = math.ceil(a / 2)
if b > d:
	print(2 * (b - d))
else:
	print(2 * b - 1)


(n, k) = map(int, input().split())
if n % 2 == 0:
	t1 = n / 2
else:
	t1 = (n - 1) / 2 + 1
if k <= t1:
	print(str(int((k - 1) * 2 + 1)))
else:
	print(str(int(k - t1 - 1) * 2 + 2))


(n, k) = [int(s) for s in input().split(' ')]
if n % 2 == 0:
	npair = n / 2
	nimpair = npair
	if k > nimpair:
		print(int(2 * (k - nimpair)))
	else:
		print(int(2 * k - 1))
else:
	npair = int(n / 2)
	nimpair = npair + 1
	if k > nimpair:
		print(int(2 * (k - nimpair)))
	else:
		print(int(2 * k - 1))


(n, k) = map(int, input().split())
num_odds = (n + 1) // 2
if k <= num_odds:
	print(int(1 + (k - 1) * 2))
	exit()
k -= num_odds
print(int(2 + (k - 1) * 2))


def main():
	num_list = list(input().split())
	(a, b) = (int(num_list[0]), int(num_list[1]))
	if a % 2 == 0:
		if b * 2 <= a:
			print(b * 2 - 1)
		else:
			print(2 * b - a)
	else:
		a += 1
		if b * 2 <= a:
			print(b * 2 - 1)
		else:
			print(2 * b - a)
main()


(n, k) = map(int, input().split())
n_o = int(n / 2 + 0.5)
if k <= n_o:
	print(2 * k - 1)
else:
	k = k - n_o
	print(2 * k)


import sys
s = input()
(n, k) = s.split(' ')
n = int(n)
k = int(k)
if n % 2 != 0:
	n += 1
if k > n / 2:
	k = k - n / 2
	print(int(2 * k))
	sys.exit()
if k <= n / 2:
	print(int(2 * k - 1))
	sys.exit()


(n, k) = map(int, input().split())
o = range(1, n + 1, 2)
e = range(2, n + 1, 2)
k -= 1
t = n // 2
if n % 2 == 0:
	if k < n // 2:
		print(o[k])
	else:
		print(e[k - n // 2])
elif k <= n // 2 + 1:
	print(o[k])
else:
	print(e[k - n // 2 - 1])


num = [int(n) for n in input().split()]
if num[1] <= (num[0] + 1) // 2:
	print(num[1] * 2 - 1)
else:
	print(2 * (num[1] - (num[0] + 1) // 2))


import math
(n, k) = input().split()
k1 = int(k)
t = math.ceil(int(n) / 2)
if k1 > t:
	print(2 * (k1 - t))
else:
	print(2 * k1 - 1)


from heapq import heappush, heappop
import queue
import re
import math
import functools

def int_raw():
	return int(input())

def ss_raw():
	return input().split()

def ints_raw():
	return list(map(int, ss_raw()))
INF = 1 << 29

def make1d_arr(n, val=INF):
	return [val for i in range(n)]

def make2d_arr(h, w, val=INF):
	return [[val for i in range(w)] for i in range(h)]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
(N, K) = ints_raw()

def main():
	if K <= (N + 1) // 2:
		return K * 2 - 1
	else:
		return (K - (N + 1) // 2) * 2
print(main())


(n, k) = map(int, input().split())
k = k - 1
p = n / 2
if int(p) != 0 and p % int(p) >= 0.5:
	p = int(p) + 1
if k < p:
	print(int(2 * k + 1))
else:
	print(int(2 * (k + 1 - p)))


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, k) = rinput()
k -= 1
if n % 2 == 0:
	temp = n / 2
	if k < temp:
		a = 1 + k * 2
	else:
		a = 2 + (k - temp) * 2
else:
	temp = (n + 1) / 2
	if k < temp:
		a = 1 + k * 2
	else:
		a = 2 + (k - temp) * 2
print(int(a))


(n, k) = input().split()
n = int(n)
k = int(k)
count = 0
if n % 2 == 0:
	count = int(n / 2)
else:
	count = int((n + 1) / 2)
if k <= count:
	print(int(k * 2 - 1))
else:
	print(int(k - count) * 2)


(n, k) = input().split()
n = int(n)
k = int(k)
a = []
if n % 2 == 0:
	if k <= n / 2:
		p = 2 * k - 1
		print(round(p))
	elif k > n / 2:
		d = k - n / 2
		p = 2 * d
		print(round(p))
elif n % 2 != 0:
	if k <= (n + 1) / 2:
		p = 2 * k - 1
		print(round(p))
	elif k > (n + 1) / 2:
		d = k - (n + 1) / 2
		p = 2 * d
		print(round(p))


(n, k) = list(map(int, input().split()))
c1 = n // 2
c2 = n - c1
if k <= c2:
	ans = 2 * k - 1
else:
	ans = 2 * (k - c2)
print(ans)


(p, q) = map(int, input().split())
q1 = p // 2 + p % 2
if q <= q1:
	print(q * 2 - 1)
else:
	print((q - q1) * 2)


(n, k) = map(int, input().split())
if n % 2 == 0:
	if k <= n / 2:
		fi = 2 * k - 1
	if k > n / 2:
		fi = int(2 * (k - n / 2))
if n % 2 == 1:
	if k <= (n + 1) / 2:
		fi = 2 * k - 1
	if k > (n + 1) / 2:
		fi = int(2 * (k - (n + 1) / 2))
print(fi)


(n, k) = [int(_) for _ in input().split()]
mid = n // 2 + n % 2
if k <= mid:
	print(2 * k - 1)
else:
	k -= mid
	print(2 * k)


from math import *
(n, k) = map(int, input().split())
print([k * 2 - 1, abs(ceil(n / 2) - k) * 2][k > ceil(n / 2)])


import sys
import math
(m, n) = map(int, sys.stdin.readline().split())
res = m / 2
res = math.ceil(res)
if res >= n:
	s = 2 * (n - 1) + 1
	print(s)
else:
	n = n - res
	s = 2 * (n - 1) + 2
	print(s)


import math

def ans(n, k):
	if n % 2 is 0:
		if k <= n / 2:
			return 1 + (k - 1) * 2
		else:
			x = k - n // 2
			return 2 + (x - 1) * 2
	else:
		if k <= math.ceil(n / 2):
			return 1 + (k - 1) * 2
		else:
			x = k - math.ceil(n / 2)
			return 2 + (x - 1) * 2
		pass
	pass
(n, k) = list(map(int, input().strip().split(' ')))
print(ans(n, k))


def find_number(n, k):
	odd_num = n // 2 + n % 2
	if k <= odd_num:
		return 2 * k - 1
	else:
		return (k - odd_num) * 2
(n, k) = input().split()
n = int(n)
k = int(k)
print(find_number(n, k))


import math

def main():
	(n, k) = map(int, input().split())
	x = math.ceil(n / 2)
	l = 1 + (k - 1) * 2
	last = 1 + (x - 1) * 2
	if l > last:
		print(l - last)
	else:
		print(l)
main()


from sys import stdin, stdout
import math
(a, b) = map(int, stdin.readline().split(' '))
mid = math.ceil(a / 2)
if b > mid:
	c = 2 + 2 * (b - (mid + 1))
	stdout.write('{}\n'.format(c))
else:
	c = 1 + 2 * (b - 1)
	stdout.write('{}\n'.format(c))


(end, place) = list(map(int, input().split()))
seperator = end // 2 + 1
if end % 2 == 1:
	seperator += 1
if place < seperator:
	print(1 + 2 * (place - 1))
else:
	print((place - seperator + 1) * 2)


t = list(map(int, input().split(' ')))
n = t[0]
k = t[1]
mid = n // 2
if n % 2 != 0:
	mid = mid + 1
if k <= mid:
	print(2 * k - 1)
else:
	k = k - mid
	print(2 * k)


(x, y) = map(int, input().split())
if x % 2 == 1:
	if y <= (x + 1) // 2:
		print(1 + 2 * (y - 1))
	else:
		print(2 + 2 * (y - (x + 1) // 2 - 1))
if x % 2 == 0:
	if y <= x // 2:
		print(1 + 2 * (y - 1))
	else:
		print(2 + 2 * (y - x // 2 - 1))


a = [int(i) for i in input().split()]
n = a[0]
k = a[1]
if k <= (n + 1) // 2:
	print((k - 1) * 2 + 1)
else:
	t = n // 2
	s = n % 2
	print((k - t - s) * 2)


from math import ceil
(n, m) = map(int, input().split())
if n % 2 != 0 and m == n // 2 + 1:
	print(n)
elif m <= n // 2:
	print(m * 2 - 1)
elif m > n // 2 and n % 2 == 0:
	print((m - n // 2) * 2)
elif m > n // 2 and n % 2 != 0:
	print((m - (n // 2 + 1)) * 2)


(N, K) = map(int, input().split())
if K <= N // 2 + N % 2:
	print(2 * K - 1)
else:
	print(2 * (K - (N // 2 + N % 2)))


t = input().split(' ')
(n, k) = (int(t[0]), int(t[1]))
if n % 2 == 0 and k <= n / 2 or (n % 2 != 0 and k < n / 2 + 1):
	k = 2 * k - 1
elif n % 2 == 0 and k > n / 2:
	k = 2 * k - n
else:
	k = 2 * k - n - 1
print(int(k))


import math
m = input()
m = m.split(' ')
n = int(m[0])
k = int(m[1])
if n % 2 == 0:
	odd = even = int(n / 2)
else:
	odd = math.ceil(n / 2)
	even = math.floor(n / 2)
if k > odd:
	l = (k - odd) * 2
	print(l)
elif k == odd:
	l = (odd - 1) * 2 + 1
	print(l)
else:
	l = (k - 1) * 2 + 1
	print(l)


t = input().split(' ')
n = int(t[0])
i = int(t[1])
a = n // 2
if n % 2 != 0:
	a += 1
if i <= a:
	print(2 * i - 1)
else:
	print(2 * (i - a))


(n, k) = map(int, input().split())
position = 0
if n % 2 == 0:
	nodd = n // 2
elif n % 2 != 0:
	nodd = n // 2 + 1
if k <= nodd:
	position = k * 2 - 1
elif k > nodd:
	position = (k - nodd) * 2
print(position)


answer = 0
(all, asked) = [int(i) for i in input().split()]
if all % 2 == 0:
	if asked * 2 <= all:
		answer = asked * 2 - 1
	else:
		answer = asked * 2 - all
elif asked * 2 <= all + 1:
	answer = asked * 2 - 1
else:
	answer = asked * 2 - all - 1
print(answer)


from math import sqrt

def calc(arr):
	(n, k) = arr
	if n % 2 == 0:
		oddc = n // 2
	else:
		oddc = (n - 1) // 2 + 1
	if n % 2 == 0:
		evenc = n // 2
	else:
		evenc = (n - 1) // 2
	if k <= oddc:
		num = k * 2 - 1
	else:
		num = (k - oddc) * 2
	return num
arr = list(map(int, input().split()))
print(calc(arr))


(n, i) = list(map(int, input().split()))
j = n // 2
j = j + n % 2
if i <= j:
	print(1 + (i - 1) * 2)
else:
	print(2 + (i - j - 1) * 2)


ipt = [int(x) for x in input().split()]
if ipt[1] <= (ipt[0] + 1) // 2:
	print(ipt[1] * 2 - 1)
else:
	print((ipt[1] - (ipt[0] + 1) // 2) * 2)


(n, k) = [int(i) for i in input().split()]
print([2 * (k - 1) + 1, 2 * (k - n // 2 - n % 2)][k > n // 2 + n % 2])


from sys import stdin
input = stdin.readline
(n, k) = map(int, str(input()).split())
if k - 1 < (n + 1) // 2:
	print(2 * k - 1)
else:
	print(2 * k - n - n % 2)


a = [int(x) for x in input().split()]
n = a[0]
k = a[1]
b = int(n / 2 + 0.5)
if k <= b:
	print(2 * k - 1)
else:
	print(2 * (k - b))


def main():
	(n, k) = map(int, sys.stdin.readline().split())
	m = n // 2 + n % 2
	val = -1
	if k > m:
		val = 2 * (k - m)
	else:
		val = 2 * k - 1
	sys.stdout.write(str(val))
import sys
main()


(n, k) = map(int, input().split())
mid = (n + 1) // 2
if k > mid:
	k = k - mid
	numbers = 2 * k
	print(numbers)
elif k <= mid:
	numbers = 2 * k - 1
	print(numbers)


(n, k) = [int(x) for x in input().split()]
limit = -(-n // 2)
num = 0
if k <= limit:
	num = 2 * k - 1
else:
	num = (k - limit) * 2
print(num)


from math import ceil
(n, k) = map(int, input().split())
odd_cnt = ceil(n / 2)
if k <= odd_cnt:
	print(str(1 + 2 * (k - 1)))
else:
	print(str(2 * (k - odd_cnt)))


n = list(map(int, input().split()))
l = []
if n[0] / 2.0 >= n[1] - 0.5:
	print(2 * n[1] - 1)
elif n[0] % 2 == 0:
	print((n[1] - n[0] // 2) * 2)
else:
	print((n[1] - n[0] // 2 - 1) * 2)


(n, b) = map(int, input().split())
if n % 2 == 0:
	z = int(n / 2)
else:
	z = int(n / 2) + 1
if b <= z:
	print(2 * b - 1)
else:
	print((b - z) * 2)


import math
d = [int(x) for x in input().split(' ')]
d[1] = d[1] - 1
if d[1] <= math.floor((d[0] - 1) / 2):
	print(2 * d[1] + 1)
else:
	d[1] -= math.floor((d[0] - 1) / 2)
	print(2 * d[1])


def rex():
	s = input().split(' ')
	n = int(s[0])
	k = int(s[1])
	if n % 2 == 0:
		if k <= n / 2:
			return 2 * k - 1
		else:
			return 2 * (k - n / 2)
	elif k <= 1 + n / 2:
		return 2 * k - 1
	else:
		return 2 * (k - (n + 1) / 2)
print(int(rex()))


import math

def main():
	(n, k) = map(int, input().split())
	odd_count = math.ceil(n / 2)
	if k <= odd_count:
		print(k * 2 - 1)
	else:
		print((k - odd_count) * 2)
main()


def eo(n, k):
	if n % 2 == 0:
		if k <= int(n / 2):
			ans = 2 * k - 1
		else:
			k = k - int(n / 2)
			ans = 2 * k
	elif k <= int(n / 2) + 1:
		ans = 2 * k - 1
	else:
		k = k - int(n / 2) - 1
		ans = 2 * k
	return int(ans)
(n, k) = input().split()
print(eo(int(n), int(k)))


def main():
	(n, k) = map(int, input().strip().split())
	if n % 2 == 0:
		x = n // 2
	else:
		x = n // 2 + 1
	if k <= x:
		ans = odd(k)
	else:
		ans = even(k - x)
	print(ans)

def odd(k):
	return k * 2 - 1

def even(k):
	return k * 2
main()


(n, k) = map(int, input().split())
i = k - (n + 1) // 2
try:
	perek = (i - abs(i)) // (2 * i)
	ans = perek * ((n + 1) // 2 * 2 - 1) + 2 * i
	print(ans)
except ZeroDivisionError:
	print((n + 1) // 2 * 2 - 1)


def Sol(n, k):
	if k <= int((n + 1) / 2):
		print(k * 2 - 1)
	else:
		print(2 * (k - int((n + 1) / 2)))
	return
(n, k) = map(int, input().split())
Sol(n, k)


import sys
(n, m) = map(int, next(sys.stdin).split())
first_odd = 1
last_odd = n if n % 2 == 1 else n - 1
n_odd = (last_odd - first_odd) / 2 + 1
if m <= n_odd:
	print(first_odd + 2 * (m - 1))
else:
	m -= n_odd
	print(int(2 + 2 * (m - 1)))


import math
(n, k) = input().split()
n = int(n)
k = int(k)
d = math.ceil(n / 2)
if k <= d:
	print(2 * k - 1)
else:
	print(2 * (k - d))


(x, y) = input().split(' ')
s = 0
if int(x) % 2 == 0:
	if int(y) <= int(x) / 2:
		s = 1 + (int(y) - 1) * 2
	else:
		s = (int(y) - int(int(x) / 2)) * 2
elif int(y) <= (int(x) + 1) / 2:
	s = 1 + (int(y) - 1) * 2
else:
	s = (int(y) - int(int(x) / 2) - 1) * 2
print(s)


import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007
ch = 'abcdefghijklmnopqrstuvwxyz'
lcm = lambda a, b: a * b // gcd(a, b)
setbit = lambda x: bin(x)[2:].count('1')
input = lambda : sys.stdin.readline()

def solve():
	(n, k) = map(int, input().split())
	part = (n + 1) // 2
	if k <= part:
		print(2 * k - 1)
	else:
		print((k - part) * 2)
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
solve()


(n, k) = map(int, input().split())
print(range(1, n + 1, 2)[k - 1] if k <= (n + 1) // 2 else range(2, n + 1, 2)[k - (n + 1) // 2 - 1])


import math
(n, k) = [int(x) for x in input().strip().split()]
if k <= math.ceil(n / 2):
	print(range(1, n + 2, 2)[k - 1])
else:
	print(range(2, n + 2, 2)[k - math.ceil(n / 2) - 1])


try:
	(a, b) = map(int, input().split())
	c = b - (a + 1) // 2
	if c > 0:
		print(2 * c)
	else:
		print(2 * b - 1)
except:
	pass


(n, k) = (int(x) for x in input().split())
nlist = []
num = int(n / 2 + n % 2)
if k > num:
	print(2 * (k - num))
else:
	print(2 * k - 1)


nk = input().split()
n = int(nk[0])
index = int(nk[1])
count = 0
if n % 2 == 0:
	n1 = n // 2
	n2 = n - n1
else:
	n1 = n // 2 + 1
	n2 = n - n1
if index <= n1:
	print(index * 2 - 1)
else:
	print((index - n1) * 2)


def _318A(n, k):
	if k <= (n + 1) // 2:
		return 2 * k - 1
	else:
		return (k - (n + 1) // 2) * 2
(n, k) = list(map(lambda x: int(x), input().split()))
print(_318A(n, k))


test = input()
arrTest = test.split(' ')
n = int(arrTest[0])
index = int(arrTest[1])
mid = int(n / 2)
if n % 2 != 0:
	mid += 1
if index > mid:
	rs = (index - mid) * 2
	print(rs)
else:
	rs = index * 2 - 1
	print(rs)


(ln, index) = map(int, input().split())
if ln % 2 != 0:
	mid = ln // 2 + 1
else:
	mid = ln // 2
if index <= mid:
	res = 1 + (index - 1) * 2
else:
	res = (index - mid) * 2
print(res)


(a, m) = map(int, input().split())
if m < int(a / 2) + 1:
	print(m + (m - 1))
elif m == int(a / 2) + 1 and a % 2 != 0:
	print(a)
elif a % 2 == 0:
	print(int((m - a / 2) * 2))
else:
	print(int((m - (int(a / 2) + 1)) * 2))


(n, k) = map(int, input().split(' '))
if k == n and n % 2 == 0:
	print(n)
	exit()
if n % 2 == 1:
	n += 1
if k <= n // 2:
	print(k * 2 - 1)
else:
	print(k % (n // 2) * 2)


def evenodd(n, k):
	array = [int(x) for x in range(1, n + 1, 2)] + [int(x) for x in range(2, n + 1, 2)]
	print(array[k - 1])
from math import ceil

def evenodd2(n, k):
	half = ceil(n / 2)
	if k <= half:
		print(2 * k - 1)
	else:
		print((k - half) * 2)
		print()
(n, k) = input().split()
evenodd2(int(n), int(k))


import math
data = input().split()
(N, K) = (int(data[0]), int(data[1]))
if K <= math.ceil(N / 2):
	print(K + (K - 1))
elif K == N and K % 2 != 0:
	print(K - 1)
elif N % 2 != 0 and K % 2 == 0 or (N % 2 != 0 and K % 2 != 0):
	print(K - (N - K) - 1)
else:
	print(K - (N - K))


aa = input().split(' ')
ln = int(aa[0])
ind = int(aa[1])
ans = 0
if ln % 2 == 0:
	if ind - 1 >= ln / 2:
		ans = (ind - ln / 2) * 2
	else:
		ans = ind * 2 - 1
elif ind > int(ln / 2) + 1:
	ans = (ind - int(ln / 2) - 1) * 2
else:
	ans = ind * 2 - 1
print(int(ans))


num = list(map(int, input().rstrip().split()))
n = num[0]
k = num[1]
if k <= (n + 1) / 2:
	k = 2 * k - 1
else:
	k = 2 * int(k - n / 2)
print(k)


def get_nth_even(n):
	return (n - 1) * 2 + 2

def get_nth_odd(n):
	return (n - 1) * 2 + 1

def solve():
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		odd_ends_at = n // 2
	else:
		odd_ends_at = n // 2 + 1
	if k > odd_ends_at:
		print(get_nth_even(k - odd_ends_at))
	else:
		print(get_nth_odd(k))
solve()


(n, k) = (int(x) for x in input().split())
even_arr = []
odd_arr = []
final = []
if n % 2 == 0:
	n = n / 2
	if k > n:
		k -= n
		print(int(k * 2))
	else:
		print(int(k * 2 - 1))
else:
	n = n // 2 + 1
	if k > n:
		k -= n
		print(int(k * 2))
	else:
		print(int(k * 2 - 1))


(n, k) = input().split()
ot = 0
if int(n) % 2 == 0:
	ot = (int(n) - 1 - 1) / 2 + 1
else:
	ot = (int(n) - 1) / 2 + 1
if int(k) > ot:
	k = int(k) - ot
	print(int(k) * 2)
else:
	print(int(k) * 2 - 1)


(n, k) = map(int, input().split())
start_even = 0
if n % 2 == 0:
	start_even = n // 2 + 1
else:
	start_even = (n + 1) / 2 + 1
if k < start_even:
	num = k * 2 - 1
elif k > start_even:
	k = k - start_even + 1
	num = format(k * 2, '.0f')
else:
	num = 2
print(num)


def VolodyaManipulations(n, k):
	res = n // 2 if n % 2 == 0 else n // 2 + 1
	if k <= res:
		return 2 * k - 1
	else:
		return 2 * (k - res)
(n, k) = map(int, input().split())
print(VolodyaManipulations(n, k))


(n, m) = map(int, input().split())
if n == 1000000000000 and m == 1000000000000:
	print(1000000000000)
elif n % 2 == 0:
	x = n // 2
	if m <= x:
		print(2 * m - 1)
	else:
		print(2 * (m % x))
else:
	x = n // 2 + 1
	if m <= x:
		print(2 * m - 1)
	else:
		print(2 * (m % x))


sb = str(input())
sb = sb.split(' ')
n = int(sb[0])
k = int(sb[1])
import math
i = math.ceil(n / 2) + 0.5
if k < i:
	print(str(2 * k - 1))
else:
	print(str(2 * k - 2 * math.ceil(n / 2)))


import sys
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('Yes')

def NO():
	print('No')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(n, k) = RI()
odd = n // 2 if n % 2 == 0 else n // 2 + 1
if k <= odd:
	print(2 * (k - 1) + 1)
else:
	k = k - odd
	print(2 * k)


nk = input()
nk = nk.split(' ')
nk[0] = int(nk[0])
nk[1] = int(nk[1])
if nk[0] % 2 == 0:
	mid = nk[0] / 2
else:
	mid = (nk[0] + 1) / 2
if nk[1] <= mid:
	ans = int(2 * nk[1] - 1)
else:
	nk[1] = nk[1] - mid
	ans = int(2 * nk[1])
print(ans)


nums = input().split()
nums = [int(x) for x in nums]
top = nums[0]
index = nums[1]
if index <= (top + 1) / 2:
	print(2 * index - 1)
else:
	print(2 * (index - (top + 1) // 2))


import math
(n, k) = [int(x) for x in input().split(' ')]
odds = math.ceil(n / 2)
evens = math.floor(n / 2)
if k > odds:
	print((k - odds) * 2)
else:
	print(k * 2 - 1)


(a, k) = map(int, input().split())
x = a // 2
if a % 2 == 0:
	if x < k:
		c = k - x
		print(2 * c)
	else:
		print(2 * (k - 1) + 1)
elif x + 1 < k:
	c = k - x - 1
	print(2 * c)
else:
	print(2 * (k - 1) + 1)


s = input().split(' ')
(n, k) = [int(s[i]) for i in range(0, 2)]
if n % 2 == 0:
	if k <= n // 2:
		r = k * 2 - 1
	else:
		r = k * 2 - n
elif k <= n // 2 + 1:
	r = k * 2 - 1
else:
	r = (k - n // 2 - 1) * 2
print(r)


maxi = [int(x) for x in input().split()]
yolo = []
import math
if maxi[1] <= math.ceil(maxi[0] / 2):
	print(2 * (maxi[1] - 1) + 1)
else:
	print(2 * abs(math.ceil(maxi[0] / 2) - maxi[1]))


(n, k) = input().split(' ')
n = int(n)
k = int(k)
if n % 2 != 0:
	totalEven = int((n - 1) / 2)
	totalOdd = totalEven + 1
else:
	totalEven = int(n / 2)
	totalOdd = totalEven
if k - totalOdd > 0:
	print(int(2 * (k - totalOdd)))
else:
	print(int(2 * k - 1))


s = input()
l = list(map(int, s.split(' ')))
print(2 * l[1] - 1 if 2 * l[1] - 1 <= l[0] else 2 * (l[1] + -l[0] // 2))


from math import ceil
(N, K) = map(int, input().split())
odds = int(ceil(N / 2))
if K <= odds:
	print(K + (K - 1) if K != 1 else 1)
else:
	K = K - odds
	print(2 * K)


(n, k) = map(int, input().split())
threshold = n // 2 + n % 2
if k < 1 + threshold:
	print(k * 2 - 1)
else:
	print((k - threshold) * 2)


(a, b) = input().split()
a = eval(a)
b = eval(b)
c = (a + 1) // 2
if b <= c:
	print(1 + 2 * (b - 1))
else:
	print(2 + 2 * (b - c - 1))


(n, k) = map(int, input().split())
count_of_chet = n // 2
count_of_nechet = n - count_of_chet
if k <= count_of_nechet:
	print(k * 2 - 1)
else:
	k -= count_of_nechet
	print(k * 2)


from math import ceil
(n, k) = map(int, input().split())
impar = ceil(n / 2)
par = n // 2
if k <= impar:
	print(2 * k - 1)
else:
	print(2 * (k - impar))


n_and_k = input().split()
n = int(n_and_k[0])
k = int(n_and_k[1])
if n % 2 == 0:
	x = n / 2
	if k <= x:
		print(k * 2 - 1)
	else:
		y = k - x
		print(int(y * 2))
elif k <= n / 2 + 1:
	print(k * 2 - 1)
else:
	x = int(n / 2 + 1)
	y = k - x
	print(int(y * 2))


(n, pos) = map(int, input().split())
evenn = n // 2
oddn = n - evenn
if pos <= oddn:
	print(2 * pos - 1)
else:
	print(2 * (pos - oddn))


(x, y) = [int(q) for q in input().split()]
mid = x // 2
if x % 2 != 0:
	mid = mid + 1
if x == 1 or y == 1:
	print(1)
elif y <= mid:
	a = 2 * y - 1
	print(a)
else:
	d = 2 * (y - mid)
	print(d)


(n, k) = input().split()
n = int(n)
k = int(k)
if n % 2 == 0:
	even = int(n / 2)
	odd = int(n / 2)
	if k <= even:
		ans = 1 + (k - 1) * 2
	else:
		diff = k - even
		ans = 2 + (diff - 1) * 2
else:
	odd = int(n / 2)
	even = int(n / 2) + 1
	if k <= even:
		ans = 1 + (k - 1) * 2
	else:
		diff = k - even
		ans = 2 + (diff - 1) * 2
print(ans)


numbers = input().split(' ')
loc = int(numbers[1]) - 1
if int(numbers[0]) % 2 == 0:
	oddCt = 0
	evenCt = int(numbers[0]) // 2
else:
	oddCt = 0
	evenCt = int(numbers[0]) // 2 + 1
if loc < evenCt:
	print(2 * (loc + 1) - 1)
else:
	print(2 * (int(numbers[1]) - evenCt))


def odd_even(n, k):
	if n % 2 == 0:
		if k > n / 2:
			return 2 * (k - n / 2)
		else:
			return 2 * k - 1
	elif k > n // 2 + 1:
		return 2 * (k - 1 - n // 2)
	else:
		return 2 * k - 1
(n, k) = input().split()
print(int(odd_even(int(n), int(k))))


def sort_nums(n, k):
	n = int(n)
	k = int(k)
	if k <= int(n / 2) + 1 and n % 2 or (k <= int(n / 2) and n % 2 == 0):
		return 2 * (k - 1) + 1
	elif n % 2 != 0:
		return 2 * (k - int(n / 2) - 1)
	else:
		return 2 * (k - int(n / 2))
data = input()
data = data.split(' ')
n = data[0]
k = data[1]
print(sort_nums(n, k))


x = input().split()
y = int(x[0])
z = int(x[1])
if y % 2 == 0:
	if z <= y // 2:
		print(z * 2 - 1)
	else:
		m = z - y // 2
		print(m * 2)
elif z <= y // 2 + 1:
	print(z * 2 - 1)
else:
	m = z - (y // 2 + 1)
	print(m * 2)


import math

def codeforces():
	(n, k) = map(int, input().split())
	if k <= math.ceil(n / 2):
		lst = range(1, n + 1, 2)
		return lst[k - 1]
	else:
		lst = range(2, n + 1, 2)
		return lst[k - 1 - math.ceil(n / 2)]
print(codeforces())


(n, k) = map(int, input().split())
no_of_even = n // 2
no_of_odd = n - no_of_even
if k <= no_of_odd:
	print(2 * k - 1)
else:
	print(2 * (k - no_of_odd))


(s, k) = map(int, input().split())
n_ss = s // 2
n_ll = s - n_ss
if k <= n_ll:
	print(1 + 2 * (k - 1))
else:
	k = k - n_ll
	print(2 * k)


import math

class Code:

	def __init__(self):
		(self.n, self.k) = list(map(int, input().split()))

	def process(self):
		if self.k > math.ceil(self.n / 2):
			start = 2
			end = self.n - 1 if self.n % 2 == 1 else self.n
			self.k -= math.ceil(self.n / 2)
		else:
			start = 1
			end = self.n - 1 if self.n % 2 == 0 else self.n
		range_n = range(start, end + 1, 2)
		print(range_n[self.k - 1])
code = Code()
code.process()


(n, x) = [int(j) for j in input().split()]
middle = n // 2 + n % 2
if x <= middle:
	print(2 * x - 1)
else:
	print(2 * (x - middle))


(n, k) = [int(x) for x in input().split(' ')]
odd_num = n // 2 + (1 if n % 2 != 0 else 0)
even_num = n // 2
if k <= odd_num:
	print(2 * k - 1)
else:
	print(2 * (k - odd_num))


def solve(n: int, k: int):
	if n % 2 == 0:
		if k > int(n) / 2:
			return (k - int(n) / 2) * 2
		else:
			return k * 2 - 1
	elif k > int(n) / 2 + 1:
		return (k - (int(n / 2) + 1)) * 2
	else:
		return k * 2 - 1

def main():
	inp = input().split()
	n = int(inp[0])
	k = int(inp[1])
	print(int(solve(n, k)))
main()


import math
a = input()
n = int(a.split(' ')[0])
k = int(a.split(' ')[1])
if k == math.ceil(n / 2) and k % 2 == 1:
	print(n)
elif k > n / 2:
	print(int(2 * (k - math.ceil(n / 2))))
else:
	print(int(2 * k - 1))


(n, k) = input().split()
n = int(n)
k = int(k)
if n % 2 is 0:
	if k <= n / 2:
		print(int(2 * k - 1))
	else:
		print(int((k - n / 2) * 2))
if n % 2 != 0:
	if k <= n / 2 + 1:
		print(int(2 * k - 1))
	else:
		print(int((k - 1 - int(n / 2)) * 2))


(n, k) = map(int, input().split())
no_odds = (n + 1) // 2
if k <= no_odds:
	print(2 * k - 1)
else:
	print(2 * (k - no_odds))


import math
(n, k) = list(map(int, input().split()))
print(((k - math.ceil(n / 2)) * 2, k + k - 1)[k <= math.ceil(n / 2)])


n_k = [int(x) for x in input().split()]
even = False
xtra = 0
if n_k[0] % 2 == 0:
	even = True
else:
	xtra += 1
if sum(n_k) == 2:
	print(1)
elif n_k[0] == n_k[1]:
	print(n_k[0] - xtra)
elif (n_k[0] + xtra) / 2 < n_k[1]:
	print(int((n_k[1] - (n_k[0] + xtra) / 2) * 2))
else:
	print(int(n_k[1] * 2 - 1))


inp1 = str(input())
inp = inp1.split()
n = int(inp[0])
k = int(inp[1])
if n % 2 == 0:
	if k <= n // 2:
		print(k * 2 - 1)
	else:
		print((k - n // 2) * 2)
elif k <= n // 2 + 1:
	print(k * 2 - 1)
else:
	print((k - (n // 2 + 1)) * 2)


(n, k) = [int(i) for i in input().split()]
if n % 2 == 0:
	m = n // 2
	if k <= m:
		uk = 2 * k - 1
	else:
		k = k - m
		uk = 2 * k
else:
	m = n // 2 + 1
	if k <= m:
		uk = 2 * k - 1
	else:
		k = k - m
		uk = 2 * k
print(uk)


import math
str = input()
data = str.split()
(n, k) = (int(data[0]), int(data[1]))
odds = math.ceil(n / 2)
if k <= odds:
	result = k * 2 - 1
else:
	result = (k - odds) * 2
print(result)


x = [int(item) for item in input().split()]
x.sort()
index = x[0]
n = x[1]
if n % 2 == 0:
	if index > n / 2:
		result = int((index - n / 2) * 2)
	else:
		result = int(index * 2 - 1)
elif index > (n + 1) / 2:
	result = int((index - (n + 1) / 2) * 2)
else:
	result = int(index * 2 - 1)
print(result)


import math
list1 = input().split(' ')
n = int(list1[0])
x = int(list1[1])
if x <= math.ceil(n / 2):
	print(2 * x - 1)
else:
	print(2 * (x - math.ceil(n / 2)))


a = list(map(int, input().split()))
n = a[0]
if n % 2 == 0:
	med = int(n / 2)
else:
	med = int(n / 2 + 1)
if a[1] <= med:
	print((a[1] - 1) * 2 + 1)
else:
	print((a[1] - med) * 2)


def evenodd(n, k):
	if n % 2 == 1:
		odd = n // 2 + 1
	else:
		odd = n // 2
	if k <= odd:
		return 1 + 2 * (k - 1)
	else:
		return 2 * (k - odd)
(n, k) = map(int, input().split())
print(evenodd(n, k))


(numbers, position) = input().split(' ')
numbers = int(numbers)
position = int(position)
cantidad_impares = numbers - numbers // 2
if position > cantidad_impares:
	print((position - cantidad_impares) * 2)
else:
	print(position * 2 - 1)


(n, k) = map(int, input().split())
xx = n // 2 + n % 2
print([2 * (k - xx), 2 * k - 1][k < xx + 1])


[n, k] = list(map(int, input().split()))
if n % 2 == 0 and k <= n / 2 or (n % 2 != 0 and k <= (n + 1) / 2):
	print(2 * k - 1)
else:
	if n % 2 == 0:
		k = k - n / 2
	if n % 2 != 0:
		k = k - (n + 1) / 2
	print(int(2 * k))


(n, k) = [int(x) for x in input().split()]
l1 = []
l2 = []
noo = 0
noe = 0
if n % 2 == 0:
	noo = int(n / 2)
	noe = int(n / 2)
else:
	noo = int(n / 2) + 1
	noe = int(n / 2)
if k <= noo:
	print(2 * k - 1)
else:
	k -= noo
	print(2 * k)


import math
(n, k) = [int(a) for a in input().split()]
p = math.ceil(n / 2)
if k <= p:
	s = k * 2 - 1
else:
	s = 2 * (k - p)
print(s)


def main():
	_ = input().split(' ')
	(n, k) = [int(i) for i in _]
	if n % 2 == 0:
		last_odd_index = n // 2
	else:
		last_odd_index = n // 2 + 1
	if k > last_odd_index:
		k = k - last_odd_index
		print(k * 2)
	else:
		print(k * 2 - 1)
main()


def EvenOdds():
	(x, y) = map(int, input().split())
	l = x // 2 if x % 2 == 0 else x // 2 + 1
	if y <= l:
		sum = 1 + (y - 1) * 2
		print(sum)
	else:
		sum = 2 + (y - l - 1) * 2
		print(sum)
EvenOdds()


while True:
	(n, k) = map(int, input().split())
	if 1 <= k <= n and n <= 10 ** 12:
		break
if n % 2 == 0:
	if k <= n // 2:
		print(2 * k - 1)
	else:
		print(2 * (k - n // 2))
elif k <= (n + 1) // 2:
	print(2 * k - 1)
else:
	print(2 * (k - (n + 1) // 2))


inputLine = input()
inputList = inputLine.split(' ')
maximum = int(inputList[0])
target = int(inputList[1])
border = int(maximum / 2 if maximum % 2 == 0 else maximum // 2 + 1)
print(2 * (target - border) if target > border else 2 * target - 1)


(x, y) = input().split()
x = int(x)
y = int(y)
if y <= (x + 1) / 2:
	print(2 * y - 1)
else:
	print((y - (x + 1) // 2) * 2)


(m, index) = [int(x) for x in input().split()]
if m % 2 == 0:
	if index <= m // 2:
		print(index * 2 - 1)
	else:
		index -= m // 2
		print(index * 2)
elif index <= m // 2 + 1:
	print(index * 2 - 1)
else:
	index -= m // 2 + 1
	print(index * 2)


import sys, os.path, math
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

def i():
	return sys.stdin.readline().strip()

def ii():
	return int(sys.stdin.readline())

def li():
	return list(sys.stdin.readline().strip())

def mii():
	return map(int, sys.stdin.readline().split())

def lii():
	return list(map(int, sys.stdin.readline().strip().split()))

def solve():
	(a, b) = mii()
	if a % 2 == 0:
		if b <= a // 2:
			print(2 * b - 1)
		else:
			print(2 * (b - a // 2))
	elif b <= a // 2 + 1:
		print(2 * b - 1)
	else:
		print(2 * (b - 1 - a // 2))
solve()


(p, q) = input().split()
(p, q) = (int(p), int(q))
if q <= (p + 1) // 2:
	print(q * 2 - 1)
else:
	print((q - (p + 1) // 2) * 2)


import math
(n, x) = list(map(int, input().split()))
o = math.ceil(n / 2)
e = n - o
if x > o:
	print(2 * (x - o))
else:
	print(1 + 2 * (x - 1))


(a, b) = input().split()
a = int(a)
b = int(b)
c = a // 2
d = a - c
if b <= d:
	print(2 * b - 1)
else:
	e = b - d
	print(2 * e)


a = list(map(int, input().split()))
a1 = a[0]
a2 = a[1]
b = 2 * a2 - 1
if a1 >= b:
	print(b)
else:
	b = (b - a1 + 1) // 2
	print(2 * b)


parametrs = list(map(int, input().split()))
n = parametrs[0]
k = parametrs[1]
if n % 2 == 0:
	n_chet = n // 2
	n_nechet = n_chet
else:
	n_chet = n // 2
	n_nechet = n_chet + 1
if k <= n_nechet:
	value = 1 + 2 * (k - 1)
else:
	postion = k - n_nechet
	value = 2 + 2 * (postion - 1)
print(value)


import math
(n, k) = input().split()
n = int(n)
k = int(k)
mid = n // 2 + 1 if n % 2 == 1 else n // 2
if k <= mid:
	print(2 * k - 1)
else:
	print((k - mid) * 2)


import sys
(n, m) = map(int, input().split())
if m <= (n + 1) // 2:
	print(m * 2 - 1)
else:
	print((m - (n + 1) // 2) * 2)


import math
(n, k) = map(int, input().split())
li = []
if k <= math.ceil(n / 2):
	d = 2
	a = 1
	print(a + (k - 1) * d)
else:
	k = k - math.ceil(n / 2)
	d = 2
	a = 2
	print(a + (k - 1) * d)


(x, y) = map(int, input().split())
d = (x + 1) // 2
if y > d:
	print(2 * (y - d))
else:
	print(2 * y - 1)


a = [int(i) for i in input().split(' ')]
n = a[0]
k = a[1]
e = n // 2
ue = n - e
if k <= n - e:
	print(2 * k - 1)
else:
	print(2 * (ue - k) * -1)


nkStr = input()
n = int(nkStr.split()[0])
k = int(nkStr.split()[1])
ans = 0
if n % 2 == 0:
	if k <= n // 2:
		ans = 2 * k - 1
	else:
		ans = 2 * (k - n // 2)
elif k <= n // 2 + 1:
	ans = 2 * k - 1
else:
	ans = 2 * (k - n // 2 - 1)
print(ans)


import sys

def main():
	(n, k) = list(map(int, sys.stdin.readline().split()))
	max_odd_pos = int(n / 2)
	if n % 2 == 1:
		max_odd_pos += 1
	if k <= max_odd_pos:
		print(k * 2 - 1)
	else:
		print((k - max_odd_pos) * 2)

def __starting_point():
	return main()
__starting_point()


numbers = list(map(int, input().split()))
n = numbers[0]
k = numbers[1]
even = int(n / 2)
odd = n - even
if k <= odd:
	print(1 + (k - 1) * 2)
else:
	print(2 + (k - odd - 1) * 2)


import sys
from math import ceil
my_file = sys.stdin
line = my_file.readline().split()
(n, k) = (int(line[0]), int(line[1]))
if n % 2 == 0:
	if k <= n / 2:
		print(k * 2 - 1)
	else:
		print(int((k - n / 2) * 2))
elif k <= ceil(n / 2):
	print(k * 2 - 1)
else:
	print(int((k - ceil(n / 2)) * 2))


(n, k) = [int(z) for z in input().split()]
if n % 2 == 0:
	j = n // 2
	if k > j:
		l = k - j
		ans = 2 * l
		print(ans)
	if k <= j:
		m = 2 * k - 1
		print(m)
elif n % 2 != 0:
	j = (n + 1) // 2
	if k > j:
		l = k - j
		ans = 2 * l
		print(ans)
	if k <= j:
		m = 2 * k - 1
		print(m)


def eo(n, k):
	if n % 2 == 0:
		half = n // 2
	else:
		half = n // 2 + 1
	if k <= half:
		return 2 * k - 1
	else:
		return 2 * (k - half)
(n, k) = map(int, input().split())
print(eo(n, k))


(n, k) = map(int, input().split())
jj = k * 2 - 1
if jj > n:
	jj -= n
	if n % 2 == 0:
		jj += 1
print(jj)


(number, k) = map(int, input().strip().split(' '))
number_of_odds = (number + 1) // 2
if k <= number_of_odds:
	print(2 * k - 1)
else:
	print(2 * (k - number_of_odds))


(n, x) = map(int, input().split())
(odds, evens) = ((n + 1) // 2, n // 2)
if x <= odds:
	print(int(x * 2) - 1)
else:
	print(int((x - odds) * 2))


def main(args):
	(a, b) = [int(x) for x in input().split()]
	if a % 2 == 0:
		if b > a // 2:
			res = 2 * (b - a // 2)
		else:
			res = 2 * b - 1
	elif b <= a // 2 + 1:
		res = 2 * b - 1
	else:
		res = 2 * (b - (a // 2 + 1))
	print(res)
	return 0
import sys
sys.exit(main(sys.argv))


(n, k) = [int(i) for i in input().split()]
a = []
b = []
c = []
import math
m = math.ceil(n / 2)
if k <= m:
	print(2 * k - 1)
elif k > m:
	print(2 * (k - m))


def solve(n, k):
	if n % 2 == 0:
		if k <= n // 2:
			return 2 * k - 1
		return 2 * (k - n // 2)
	if k <= n // 2 + 1:
		return 2 * k - 1
	return 2 * (k - (n // 2 + 1))
(n, k) = map(int, input().split())
print(solve(n, k))


(n1, n2) = [int(n) for n in input().split()]
if n1 % 2 == 0:
	if n2 > n1 / 2:
		a = n2 - n1 / 2
		print(int(2 * a))
	else:
		print(int(2 * n2 - 1))
else:
	od = (n1 + 1) / 2
	eve = n1 - od
	if n2 > (n1 + 1) / 2:
		a = n2 - (n1 + 1) / 2
		print(int(2 * a))
	else:
		print(int(2 * n2 - 1))


t = input().split()
n = int(t[0])
t = int(t[1])
t -= 1
if n % 2 == 0 and t >= n // 2:
	t += 1
if t < n / 2:
	print(2 * t + 1)
else:
	print(2 * (t - n // 2))


import sys

class Scanner:

	def __init__(self):
		self.current_tokens = []

	def remaining_tokens(self):
		return len(self.current_tokens)

	def nextline(self):
		assert self.remaining_tokens() == 0, 'Reading next line with remaining tokens'
		return input()

	def nexttokens(self):
		return self.nextline().split()

	def nexttoken(self):
		if len(self.current_tokens) == 0:
			self.current_tokens = self.nexttokens()
		assert self.remaining_tokens() > 0, 'Not enough tokens to parse.'
		return self.current_tokens.pop(0)

	def nextints(self, n=-1):
		if n == -1:
			return list(map(int, self.nexttokens()))
		else:
			return [self.nextint() for i in range(n)]

	def nextint(self):
		return int(self.nexttoken())

def quit():
	sys.exit(0)
stdin = Scanner()
nextint = stdin.nextint
nextints = stdin.nextints
nextline = stdin.nextline
(n, k) = nextints()
if n % 2 == 0:
	if k > n // 2:
		r = 2 * (k - n // 2)
	else:
		r = 2 * k - 1
elif k > n // 2 + 1:
	r = 2 * (k - (n // 2 + 1))
else:
	r = 2 * k - 1
print(r)


(n, k) = [int(n) for n in input().split()]
s = n // 2
c = 1
d = 2
if n % 2 == 0:
	a = s
	b = n - a
else:
	a = s + 1
	b = n - a
while k > 0:
	if k <= a:
		g = c + 2 * (k - 1)
		print(g)
	else:
		e = k - a
		l = d + 2 * (e - 1)
		print(l)
	k = 0


import math
n = input().split()
if int(n[1]) <= math.ceil(int(n[0]) / 2):
	p = int(2 * (2 + int(n[1]) - 2) - 1)
	print(p)
else:
	p = int(2 * (2 + int(n[1]) - math.ceil(int(n[0]) / 2) - 2))
	print(p)


import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 10 ** 9 + 7

def main():
	(n, k) = read()
	mid = n // 2 + n % 2
	if k <= mid:
		print(2 * (k - 1) + 1)
	else:
		print(2 * (k - mid))
main()


(n, k) = map(int, input().split())
ch = 0
nech = 0
s = 0
if n % 2 == 0:
	ch = n // 2
	nech = n // 2
else:
	ch = n // 2
	nech = n // 2 + 1
if k > nech:
	k = k - nech
	s = 2 * k
else:
	s = 1 + 2 * (k - 1)
print(s)


(N, k) = map(int, input().split())
if N % 2 == 1:
	temp = N // 2 + 1
	if k <= temp:
		ans = k * 2 - 1
	else:
		temp -= k
		temp = abs(temp)
		ans = temp * 2
else:
	temp = N // 2
	if k <= temp:
		ans = k * 2 - 1
	else:
		temp -= k
		temp = abs(temp)
		ans = temp * 2
print(ans)


x = input().split()
k = 0
l = 0
output = 0
if int(x[0]) % 2 == 0:
	l = int(int(x[0]) / 2)
else:
	l = int(int(x[0]) / 2) + 1
if l >= int(x[1]):
	output = int(x[1]) * 2 - 1
else:
	output = (int(x[1]) - l) * 2
print(output)


(n, m) = input().split(' ')
(n, m) = (int(n), int(m))
i = 1
if n % 2 == 0:
	d = n // 2
else:
	d = n // 2 + 1
if m <= d:
	i = 1
	print(i + (m - 1) * 2)
else:
	i = 2
	m = m - d
	print(i + (m - 1) * 2)


def sex_identifier(user):
	user = set(user)
	if len(user) % 2 == 0:
		return 'CHAT WITH HER!'
	else:
		return 'IGNORE HIM!'

def volodya(line):
	args = [int(x) for x in line.split(' ')]
	if args[0] % 2 == 0:
		if args[1] <= args[0] / 2:
			return -1 + 2 * args[1]
		else:
			return 0 + 2 * (args[1] - args[0] // 2)
	elif args[1] <= args[0] // 2 + 1:
		return -1 + 2 * args[1]
	else:
		return 0 + 2 * (args[1] - args[0] // 2 - 1)
print(volodya(input()))


nk = input().split()
n = int(nk[0])
k = int(nk[1])
if n % 2 == 0 and k <= n // 2:
	print(2 * k - 1)
elif n % 2 == 0 and k > n // 2:
	print(2 * (k - n // 2))
elif n % 2 != 0 and k <= n // 2 + 1:
	print(2 * k - 1)
elif n % 2 != 0 and k > n // 2 + 1:
	print(2 * (k - (n // 2 + 1)))


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def main():
	try:
		(n, k) = In()
		temp = math.ceil(n / 2)
		if k > temp:
			t = n - k
			print(2 * (k - temp))
		else:
			print(k * 2 - 1)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, k) = get_ints()
if n & 1:
	if k <= n // 2 + 1:
		print(2 * k - 1)
	else:
		k -= n // 2 + 1
		print(2 * k)
elif k <= n // 2:
	print(2 * k - 1)
else:
	k -= n // 2
	print(2 * k)


(n, k) = map(int, input().split())
h = n // 2
z = n % 2
t = k - h
if z == 0:
	if t <= 0:
		print(2 * k - 1)
	else:
		print(2 * t)
elif t - 1 <= 0:
	print(2 * k - 1)
else:
	print(2 * (t - 1))


inp = input().split()
n = int(inp[0])
k = int(inp[1])
num_of_odd = int(n / 2 + 0.5)
if k <= num_of_odd:
	print(int(2 * (k - 1) + 1))
else:
	print(int(2 * (k - num_of_odd)))


(n, m) = map(int, input().split())
z = n // 2
f = n - z
if m <= f:
	print(m * 2 - 1)
else:
	yy = m - f
	print(yy * 2)


import math
numbers = list(map(int, input().split()))
n = numbers[0]
k = numbers[1]
medio = math.ceil(n / 2)
if k > medio:
	print((k - medio) * 2)
else:
	print(k * 2 - 1)


n = list(map(int, input().split()))
t = int(n[0] / 2)
f = n[0] - t
if n[1] <= f:
	print(int(2 * n[1] - 1))
else:
	print(int(2 * (n[1] - f)))


S = input().split()
n = int(S[0])
p = int(S[1])
if n % 2 == 0:
	if p <= n // 2:
		print(p * 2 - 1)
	else:
		print((p - n // 2) * 2)
elif p <= n // 2 + 1:
	print(p * 2 - 1)
else:
	print((p - (n // 2 + 1)) * 2)


(n, k) = map(int, input().split())
oddsize = n // 2 + 1
evensize = n // 2
if n % 2 == 1:
	if k <= oddsize:
		print(1 + 2 * (k - 1))
	else:
		k -= oddsize
		print(2 + 2 * (k - 1))
elif k <= evensize:
	print(1 + 2 * (k - 1))
else:
	k -= evensize
	print(2 + 2 * (k - 1))


import math
(n, k) = map(int, input().split())
od = []
ev = []
if k <= math.ceil(n / 2) and k <= n:
	r = 2 * k - 1
else:
	k = k - math.ceil(n / 2)
	r = 2 * k
print(r)


(n, k) = map(int, input().split())
p = k - (n + 1) // 2
print([2 * k - 1, 2 * p][p > 0])


from math import ceil
(all, pos) = map(int, input().split())
if pos <= ceil(all / 2):
	print(2 * pos - 1)
else:
	print(2 * (pos - ceil(all / 2)))


import math
l = list(map(int, input().split()))
n = l[0]
k = l[1]
if n == 1 and k == 1:
	print(1)
elif n % 2 == 0:
	if k <= int(math.floor(n / 2)):
		print(2 * (k - 1) + 1)
	else:
		print(2 * (k - int(math.ceil(n / 2))))
elif k <= int(math.floor(n / 2)) + 1:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - int(math.ceil(n / 2))))


(n, k) = [float(inputNum) for inputNum in input().split()]
(helper, result) = (0, 0)
if n % 2 == 0:
	helper = n / 2
else:
	helper = (n + 1) / 2
if k > helper:
	result = 2 * (k - helper)
else:
	result = 1 + 2 * (k - 1)
print(int(result))


import math
(n, k) = map(int, input().split())
oddn = math.ceil(n / 2)
evnn = n - oddn
if k > oddn:
	k -= oddn
	print(k * 2)
else:
	print(k * 2 - 1)


(n, k) = map(int, input().split())
zhup = n // 2
tak = n - zhup
if k > tak:
	s = (k - tak) * 2
elif k <= tak:
	s = k * 2 - 1
print(s)


import math
(num, k) = map(int, input().split())
odd = 0
even = 0
if k <= (num + 1) / 2:
	odd = 2 * k - 1
	print(odd)
elif k >= (num + 1) / 2:
	even = 2 * (k - math.floor((num + 1) / 2))
	print(even)


def read_ints():
	temp = input()
	ints = [int(t) for t in temp.split(' ')]
	return ints
(n, k) = read_ints()
odds = (n + 1) // 2
if odds < k:
	print(2 * (k - odds))
else:
	print(1 + 2 * (k - 1))


import math
(n, p) = map(int, input().split())
up = math.ceil(n / 2)
if p > up:
	p = p - up
	print(2 * p)
else:
	print(2 * p - 1)


import sys
import os
(n, k) = input().split()
n = int(n)
k = int(k)
if n % 2 == 1:
	n += 1
if n / 2 >= k:
	ans = int(2 * k - 1)
else:
	ans = int(n - 2 * (n - k))
print(ans)


string = input().split()
n = int(string[0])
k = int(string[1])
if n % 2 == 0:
	if k > n / 2:
		print(int(2 * (k - n / 2)))
	else:
		print(int(2 * k - 1))
n1 = int((n + 1) / 2)
if n % 2 != 0 and k > n1:
	print(int(2 * (k - n1)))
if n % 2 != 0 and k <= n1:
	print(int(2 * k - 1))


l1 = [int(num) for num in input().split(' ')]
n = l1[0]
k = l1[1]
if n % 2 == 0:
	if k <= n // 2:
		print(2 * k - 1)
	else:
		print(2 * (k - n // 2))
elif k <= n // 2 + 1:
	print(2 * k - 1)
else:
	print(2 * (k - n // 2 - 1))


from math import ceil
things = input()
nandk = things.split(' ')
n = int(nandk[0])
k = int(nandk[1])
if k <= ceil(n / 2):
	print(2 * k - 1)
else:
	print(2 * (k - ceil(n / 2)))


def main():
	(n, k) = list(map(int, input().split()))
	fac = n // 2
	if n % 2 != 0:
		fac += 1
	if k <= fac:
		print(1 + 2 * (k - 1))
	else:
		print(2 * (k - fac))
t = 1
while t != 0:
	main()
	t -= 1


def calc_value(n, k):
	if n % 2 == 0:
		if k <= n / 2:
			return 2 * k - 1
		elif k > n / 2:
			x = k - n / 2
			return 2 * x
	elif k <= (n + 1) / 2:
		return 2 * k - 1
	else:
		x = k - ((n + 1) / 2 + 1)
		x += 1
		return 2 * x
(n, k) = input().split()
n = int(n)
k = int(k)
print(int(calc_value(n, k)))


(n, idx) = [int(i) for i in input().split()]
odd_nums = n // 2 + n % 2
if idx > odd_nums:
	print((idx - odd_nums) * 2)
else:
	print(idx * 2 - 1)


x = list(map(int, input().split()))
n = x[0]
k = x[1]
num = 0
if n % 2 == 0:
	m = n // 2
else:
	m = n // 2 + 1
if k > m:
	num = (k - m) * 2
else:
	num = k * 2 - 1
print(num)


from math import ceil
(n, m) = list(map(int, input().split()))
num_odd = ceil(n / 2)
if m <= num_odd:
	print(2 * m - 1)
else:
	print(2 * (m - num_odd))


from math import ceil
arr = list(map(int, input().split(' ')))
n = arr[0]
k = arr[1]
if n == 3:
	if k == 1:
		print(k)
	elif k == 2:
		print(3)
	else:
		print(2)
	exit()
if n == k:
	if n == 1:
		print(1)
		exit()
	if n % 2 == 0:
		print(n)
	else:
		print(n - 1)
	exit()
if n % 2 == 0:
	if n / k >= 2:
		ans = k * 2 - 1
	else:
		ans = (k - int(n / 2)) * 2
elif n / k > 2:
	ans = (k - 1) * 2 + 1
else:
	ans = (k - ceil(n / 2)) * 2
if ans == 0:
	ans = ceil(n)
print(ans)
exit()


import math
(x, y) = input().split()
if int(x) % 2 == 0:
	if int(y) <= int(x) / 2:
		print(2 * int(y) - 1)
	else:
		print(int((int(y) - int(x) / 2) * 2))
elif int(y) <= math.ceil(int(x) / 2):
	print(2 * int(y) - 1)
else:
	print(int((int(y) - math.ceil(int(x) / 2)) * 2))


def sol(n, k):
	if n % 2 == 1:
		mid = n // 2 + 1
	else:
		mid = n // 2
	if k <= mid:
		return 2 * k - 1
	else:
		return (k - mid) * 2
(n, k) = list(map(int, input().split()))
print(sol(n, k))


import math
arr = [int(x) for x in input().split()]
n = arr[0]
k = arr[1]
median = math.ceil(n / 2)
if k <= median:
	print(2 * k - 1)
else:
	print((k - median) * 2)


def inp():
	return map(int, input().split())

def arr_inp():
	return [int(x) for x in input().split()]

def print_arr(arr):
	print(*arr, sep=' ')
import math
(n, k) = inp()
med = math.ceil(n / 2)
if k > med:
	diff = k - med
	print(diff * 2)
else:
	print(1 + 2 * (k - 1))


(p, q) = map(int, input().split())
r = q - (p + 1) // 2
print([q * 2 - 1, r * 2][r > 0])


import math as m1
(n, k) = map(int, input().split())
j = 1
m = 0
if k > m1.ceil(n / 2):
	k -= m1.ceil(n / 2)
	print(k * 2)
else:
	print(2 * k - 1)


import math
(length, index) = map(int, input().split())
if length % 2 == 0:
	if index <= length / 2:
		res = index * 2 - 1
	elif index == length:
		res = index
	elif index > length / 2:
		ind = index % (length / 2)
		res = ind * 2
elif length % 2 == 1:
	if index <= math.ceil(length / 2):
		res = index * 2 - 1
	elif index == length:
		res = index - 1
	elif index > math.ceil(length / 2):
		ind = index % math.ceil(length / 2)
		res = ind * 2
print(int(res))


(n, k_pos) = map(int, input().split())
mark = k_pos - (n + 1) // 2
print([2 * k_pos - 1, 2 * mark][mark > 0])


(n, t) = [int(x) for x in input().split()]
if t <= (n + 1) // 2:
	print(2 * t - 1)
else:
	t = t - (n + 1) // 2
	print(2 * t)


import sys
import math
instr = sys.stdin.readline().split()
n = int(instr[0])
k = int(instr[1])
res = 0
if k <= math.ceil(n / 2):
	res = 1 + (k - 1) * 2
else:
	m = k - math.ceil(n / 2)
	res = 2 + (m - 1) * 2
print(int(res))


lis = list(input().split(' '))
n = int(lis[0])
k = int(lis[1])
mark = 0
if n % 2 == 0:
	mark = n // 2
else:
	mark = n // 2 + 1
ans = 0
if k > mark:
	if n % 2 == 0:
		ans = (k - n // 2) * 2
	else:
		ans = (k - n // 2 - 1) * 2
else:
	ans = k * 2 - 1
print(ans)


a = tuple(map(int, input().split()))
x = int(a[0] / 2 + 0.5)
if a[1] <= x:
	print(2 * (a[1] - 1) + 1)
else:
	print(2 * (a[1] - x))


(n, m) = [int(x) for x in input().split()]
a = 1
b = 2
if n / 2 == int(n / 2):
	half = int(n / 2)
else:
	half = int(n / 2) + 1
if m <= half:
	print(2 * m - 1)
else:
	print(2 * (m - half))


(value, number) = map(int, input().split(' '))
if value % 2 == 0:
	temp = value // 2
	if number <= temp:
		print(2 * number - 1)
	else:
		print(2 * (number - temp))
else:
	temp = value // 2 + 1
	if number <= temp:
		print(2 * number - 1)
	else:
		print(2 * (number - temp))


import math
(n, m) = [int(i) for i in input().split()]
output = 0
temp = math.ceil(n / 2)
if temp >= m:
	output = 2 * m - 1
else:
	output = 2 * (m - temp)
print(output)


(n, k) = input().split()
(n, k) = (int(n), int(k))
odd = n // 2 + n % 2
if k <= odd:
	print(2 * k - 1)
else:
	k = k - odd
	print(2 * k)


n = map(int, input().split())
n = list(n)
k = n[1]
n = n[0]
ans = 0
if n % 2 != 0 and k <= n // 2 + 1 or (n % 2 == 0 and k <= n // 2):
	ans = k * 2 - 1
elif n % 2 != 0 and k > n // 2 + 1:
	ans = (k - (n // 2 + 1)) * 2
elif n % 2 == 0 and k > n // 2:
	ans = (k - n // 2) * 2
print(ans)


(n, k) = map(int, input().split())
o = 1
e = 0
if n % 2 == 0 and k > n // 2:
	e += 2 * (k - n // 2)
	print(e)
elif n % 2 != 0 and k > n // 2 + 1:
	e += 2 * (k - n // 2 - 1)
	print(e)
else:
	o += 2 * (k - 1)
	print(o)


import math
(num1, num2) = input().split()
num1 = int(num1)
num2 = int(num2)
if num2 <= math.ceil(num1 / 2):
	ans = num2 + num2 - 1
	print(ans)
else:
	ans = (num2 - math.ceil(num1 / 2)) * 2
	print(ans)


def judgement(n, k):
	m = n // 2 + n % 2
	if k <= m:
		return 2 * k - 1
	else:
		return 2 * (k - m)
(n, k) = map(int, input().split())
print(judgement(n, k))


values = list(map(int, input().strip().split(' ')))
n = values[0]
k = values[1]
mid = n // 2
ans = 0
if n % 2 == 1:
	mid += 1
if k <= mid:
	ans = 2 * k - 1
else:
	ans = (k - mid) * 2
print(ans)


import math
(cnt, pos) = map(int, input().split())
if pos <= math.ceil(cnt / 2):
	pos -= 1
	print(1 + pos * 2)
else:
	pos -= math.ceil(cnt / 2)
	print(2 * pos)


(n, t) = map(int, input().split())
answer = 2 * t - 1 if t <= (n + 1) // 2 else 2 * (t - (n + 1) // 2)
print(str(answer))


import math
(n, k) = list(map(int, input().split()))
m = k - 1
if m < int(math.ceil(n / 2)):
	print(2 * m + 1)
else:
	t = (m - int(math.ceil(n / 2))) * 2
	print(t + 2)


def user_input():
	return list(map(int, input().split()))

def number_stand_at_position(n, k):
	if k == 1:
		return 1
	n_event = n // 2
	n_odds = n % 2 + n_event
	if k <= n_odds:
		return k * 2 - 1
	else:
		event_nuumber_index = k - n_odds
		return event_nuumber_index * 2

def main():
	user_inputs = user_input()
	print(number_stand_at_position(user_inputs[0], user_inputs[1]))
main()


(t, n) = [int(s) for s in input().split()]
num = 0
if t % 2 != 0:
	if n <= t // 2 + 1:
		num = 2 * n - 1
	else:
		num = 2 * (n - (t // 2 + 1))
elif n <= t // 2:
	num = 2 * n - 1
else:
	num = 2 * (n - t // 2)
print(num)


def ans(n, k):
	if n % 2 == 0:
		a = int(n / 2)
	else:
		a = int(n / 2 + 1)
	if k <= a:
		return int(2 * k - 1)
	else:
		return int(2 * (k - a))
(n, k) = map(int, input().split())
print(ans(n, k))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(N, K) = map(int, input().split())
nodd = (N + 1) // 2
neven = N // 2
if nodd >= K:
	print(2 * K - 1)
else:
	K -= nodd
	print(2 * K)


import math as ma
(m, n) = list(map(int, input().split()))
if n > ma.ceil(m / 2):
	n = n - ma.ceil(m / 2)
	print(int(2 * n))
else:
	print(2 * n - 1)


import math
import os
import random
import re
import sys
total = 0
n = input().rstrip().split()
number = int(n[0])
k = int(n[1])
if number % 2 == 0:
	half = number // 2
	if half < k:
		print((k - half) * 2)
	else:
		print(k * 2 - 1)
else:
	half = number // 2 + 1
	if half < k:
		print((k - half) * 2)
	else:
		print(k * 2 - 1)


(x, y) = input().split()
[x, y] = [int(x), int(y)]
c = []
if x % 2 == 0:
	no = x // 2
else:
	no = (x + 1) // 2
ne = y - no
if y > no:
	print(2 * (y - no))
else:
	print((y - 1) * 2 + 1)


(p, k) = input().split()
p = int(p)
k = int(k)
if p % 2 != 0:
	p += 1
if k <= p / 2:
	print(k * 2 - 1)
elif k > p / 2:
	k = k - p / 2
	print(int(k * 2))


(n, k) = map(int, input().split())
if n % 2 == 1 and k <= n // 2 + 1:
	t = k * 2 - 1
if n % 2 == 0 and k <= n // 2:
	t = k * 2 - 1
if n % 2 == 1 and k > n // 2 + 1:
	t = (k - n // 2 - 1) * 2
if n % 2 == 0 and k > n / 2:
	t = (k - n // 2) * 2
print(t)


import math

def eve_odd(n, k):
	half = math.ceil(n / 2)
	if k <= half:
		return 2 * k - 1
	else:
		k = k - half
		return 2 * k
x = list(map(int, input().rstrip().split()))
print(eve_odd(x[0], x[1]))


(m, q) = map(int, input().split())
a = q - (m + 1) // 2
print([2 * q - 1, 2 * a][a > 0])


t = list(map(int, input().split()))
n = t[0]
k = t[1]
if n % 2 == 0:
	v = 1
else:
	v = 0
if v:
	if k > n // 2:
		print((k - n // 2) * 2)
	else:
		print(k * 2 - 1)
elif k > n // 2 + 1:
	print((k - (n // 2 + 1)) * 2)
else:
	print(k * 2 - 1)


import sys
n = input()
n = n.split()
k = int(n[1])
n = int(n[0])
if k <= (n + 1) // 2:
	print(int(k * 2 - 1))
else:
	print(int((k - (n + 1) // 2) * 2))


from math import ceil
(k, n) = (int(x) for x in input().split())
even_index = ceil(k / 2) + 1
result = None
if n < even_index:
	result = n * 2 - 1
else:
	n -= even_index
	result = (n + 1) * 2
print(result)


import math
(a, b) = input().split()
a = int(a)
b = int(b)
c = 0
if b > math.ceil(a / 2):
	c = b - math.ceil(a / 2)
	print(c * 2)
else:
	print(b * 2 - 1)


import math
l = []
for x in input().split():
	l.append(int(x))
elements = l[0]
position = l[1]
mid = math.ceil(elements / 2)
if position <= mid:
	print(position * 2 - 1)
else:
	print((position - mid) * 2)


(n, k) = map(int, input().split())
if n % 2 == 0:
	odd = n / 2
	even = n / 2
else:
	odd = (n + 1) / 2
	even = n // 2
result1 = int(1 + (k - 1) * 2)
result2 = int(2 + (k - odd - 1) * 2)
if n % 2 == 0:
	if k > n // 2:
		print(result2)
	else:
		print(result1)
elif k > n // 2 + 1:
	print(result2)
else:
	print(result1)


import math
(n, m) = map(int, input().strip().split())
if m <= math.ceil(n / 2):
	ans = 1 + (m - 1) * 2
	print(ans)
else:
	dif = m - math.ceil(n / 2)
	if n % 2 == 0 and m == n:
		ans = n
	else:
		ans = 2 + (dif - 1) * 2
	print(ans)


input = input()
numeros = input.split(' ')
n = int(numeros[0])
k = int(numeros[-1])
if n % 2 == 0:
	ln = n // 2
	li = ln
else:
	li = n // 2 + 1
	ln = li - 1
if k > li:
	print(2 * (k - li))
else:
	print(2 * k - 1)


values = input()
(n, k) = values.split()
k = int(k)
n = int(n)
if k <= (n + 1) // 2:
	print(2 * k - 1)
else:
	print((k - (n + 1) // 2) * 2)


(N, K) = [int(i) for i in input().split()]
if K > N % 2 + N // 2:
	K -= N % 2 + N // 2
	print(2 * K)
else:
	print(2 * K - 1)


def digit_position(n, i):
	p = 0
	if n % 2 != 0:
		if i <= n // 2 + 1:
			p = i * 2 - 1
		else:
			p = (i - (n // 2 + 1)) * 2
	elif i <= n // 2:
		p = i * 2 - 1
	else:
		p = (i - n // 2) * 2
	return p
(n, i) = map(int, input().split())
print(digit_position(n, i))


s = str(input())
e = s.split(' ')
d = int(e[1])
c = int(e[0])
if c % 2 == 0:
	r = int(c / 2)
	if r >= d:
		d -= 1
		print(1 + 2 * d)
	elif r < d:
		print(2 * (d - r))
elif c % 2 > 0:
	r = int(c / 2)
	r += 1
	if r >= d:
		d -= 1
		print(1 + 2 * d)
	elif r < d:
		print(2 * (d - r))


(n, k) = list(map(int, input().split(' ')))
co = (n + 1) // 2
a = 0
if k > co:
	a = (k - co) * 2
else:
	a = k * 2 - 1
print(a)


(n, k) = [int(x) for x in input().split()]
print((2 * k - 1) % (n + n % 2 + 1) + 2 * ((2 * k - 1) // (n + n % 2 + 1)))


(n, k) = input().split()
n = int(n)
k = int(k)
if k <= (n + 1) / 2:
	i = 2 * k - 1
elif k == n:
	i = 2 * (k // 2)
else:
	i = 2 * (k - n // 2 - (n - n // 2 * 2))
print(i)


def main():
	(n, k) = [int(x) for x in input().split()]
	mid = n // 2 + n % 2
	if k <= mid:
		print(2 * k - 1)
	else:
		print(2 * (k - mid))
main()


import math
(n, k) = (int(e) for e in input().split(' '))
number = 0
mid = math.ceil(n / 2)
if k > mid:
	number = (k - mid) * 2
else:
	number = 2 * k - 1
print(int(number))


(n, k) = list(map(int, input().split()))
p = n // 2 + 1 if n % 2 else n // 2
if k > p:
	k -= p
	print(k * 2)
else:
	print(k * 2 - 1)


l = list(map(int, input().split()))
n = int(l[0])
m = int(l[1])
if n % 2 == 1:
	d = n // 2 + 1
	e = n // 2
else:
	d = n // 2
	e = n // 2
if m <= d:
	result = 2 * m - 1
else:
	m = m - d
	result = 2 * m
print(result)


(a, b) = map(int, input().split())
l = []
if a % 2 == 0:
	u = a // 2
else:
	u = a // 2 + 1
if b > u:
	print(2 * (b - u))
if b <= u:
	print(2 * b - 1)


(n, k) = map(int, input().split())
if n % 2 == 0:
	max_idx_odd = n // 2
else:
	max_idx_odd = (n + 1) // 2
if k <= max_idx_odd:
	kth_num = 2 * k - 1
else:
	kth_num = 2 * (k - max_idx_odd)
print(kth_num)


import math
(nx, kx) = input().split()
n = int(nx)
k = int(kx)
if k > math.ceil(n / 2) and n % 2 == 0:
	print(2 * k - n)
elif k > math.ceil(n / 2):
	print(2 * k - n - 1)
else:
	print(2 * k - 1)


import math as mt
(l, h) = map(int, input().split(' '))
lst = []
s = 1
s1 = 0
k = mt.ceil(l / 2)
if k >= h:
	print(2 * h - 1)
elif k < h:
	print(2 * (h - k))


(n, k) = input().split()
(n, k) = (int(n), int(k))
if n % 2 == 0:
	mid = n // 2
else:
	mid = n // 2 + 1
if k <= mid:
	number = k * 2 - 1
else:
	number = (k - mid) * 2
print(number)


l = list(map(int, input().split()))
ne = int(l[0] / 2)
no = l[0] - ne
if l[1] <= no:
	print(2 * l[1] - 1)
else:
	print(2 * (l[1] - no))


(n, m) = map(int, input().split())
noe = noo = 0
if n % 2 == 0:
	noe = noo = n / 2
else:
	noe = n // 2
	noo = n // 2 + 1
if m <= noo:
	ans = 1 + (m - 1) * 2
else:
	m -= noo
	ans = 2 + (m - 1) * 2
print(int(ans))


(n, posi) = map(int, input().split())
cursor = n // 2 + n % 2
if posi <= cursor:
	print(posi * 2 - 1)
else:
	print((posi - cursor) * 2)


(n, k) = [int(i) for i in input().split()]
if n % 2 == 0:
	num_even = n // 2
	num_odd = n // 2
	if k <= num_odd:
		n_new = k - 1
		print(2 * n_new + 1)
	else:
		n_new = k - num_odd
		print(2 * n_new)
else:
	num_even = n // 2
	num_odd = (n + 1) // 2
	if k <= num_odd:
		n_new = k - 1
		print(2 * n_new + 1)
	else:
		n_new = k - num_odd
		print(2 * n_new)


(n, s) = map(int, input().split())
if n % 2 == 0:
	mid = n / 2
else:
	mid = n // 2 + 1
if s > mid:
	p = s - mid
	print(int(2 * p))
else:
	print(int(2 * s - 1))


(a, b) = map(int, input().split())
ans = 0
lim = (a + 1) // 2
if b > lim:
	ans = (b - lim) * 2
else:
	ans = 1 + 2 * (b - 1)
print(ans)


(a, b) = input().split(' ')
a = int(a)
b = int(b)
if b <= a / 2:
	print(b * 2 - 1)
elif b > a / 2 and b == a // 2 + 1 and (a % 2 == 1):
	print(a)
elif b > a / 2 and a % 2 == 0:
	print(int((b - a / 2) * 2))
elif b > a / 2 and a % 2 == 1 and (b == a // 2 + 2):
	print(b - a // 2)
elif b > a / 2 and a % 2 == 1 and (b != a // 2 + 1) and (b != a // 2 + 1):
	print((b - a // 2 - 1) * 2)


import math
d = list(map(int, input().split()))
print(1 if d[1] == 1 else 2 * (d[1] - math.ceil(d[0] / 2)) if math.ceil(d[0] / 2) < d[1] else 2 * d[1] - 1)


import sys
(n, k) = map(int, input().split(' '))
odd = -1
even = -1
if n % 2 == 0:
	odd = even = n // 2
else:
	odd = n // 2 + 1
	even = n // 2
if k <= odd:
	print(1 + (k - 1) * 2)
	sys.exit()
k -= odd
print(2 + (k - 1) * 2)


import math
n = list(map(int, input().split()))
if n[0] & 1:
	partision = math.floor(n[0] / 2) + 1
else:
	partision = math.floor(n[0] / 2)
if n[1] <= partision:
	output = 2 * n[1] - 1
else:
	output = (n[1] - partision) * 2
print(output)


a = list(map(int, input().split()))
n = a[0]
k = a[1]
if n % 2 == 0:
	ne = n // 2
	no = n // 2
else:
	ne = n // 2
	no = n // 2 + 1
if k <= no:
	print(1 + (k - 1) * 2)
elif k > no:
	k -= no
	print(2 + (k - 1) * 2)


def main(n, k):
	number_odd = n / 2 if n % 2 == 0 else int(n / 2) + 1
	if k <= number_odd:
		num = int((k - 1) * 2 + 1)
	else:
		k -= number_odd
		num = int((k - 1) * 2 + 2)
	return num

def test():
	assert main(10, 3) == 5
	assert main(7, 7) == 6
(n, k) = [int(x) for x in input().split()]
print(main(n, k))


l = [int(k) for k in input().split(' ')]
(n, k) = (l[0], l[1])
if k > (n + 1) // 2:
	print(str((k - (n + 1) // 2) * 2))
else:
	print(str((k - 1) * 2 + 1))


from math import ceil
(n, k) = (int(i) for i in input().split())
l1 = ceil(n / 2)
if k <= l1:
	x = 1 + 2 * (k - 1)
else:
	k -= l1
	x = 2 * k
print(x)


import math as m
s = str(input())
l = s.split()
n = int(l[0])
k = int(l[1])
if k <= m.ceil(n / 2):
	print(2 * k - 1)
else:
	print(2 * (k - m.ceil(n / 2)), end=' ')


import sys
from random import choice, randint
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, sys.stdin.readline().strip().split())

def LI():
	return list(map(int, sys.stdin.readline().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().strip().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().strip().split()]

def LS():
	return sys.stdin.readline().strip().split()

def I():
	return int(sys.stdin.readline().strip())

def F():
	return float(sys.stdin.readline().strip())

def S():
	return sys.stdin.readline().strip()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))
inp = sys.stdin.readline
out = sys.stdout.write

def main():
	from math import ceil
	(n, k) = MI()
	if k <= ceil(n / 2):
		pf(2 * k - 1)
	else:
		pf(2 * (k - ceil(n / 2)))
main()


s = list(map(int, input().split()))
n = s[0]
k = s[1]
cut = n // 2 if n % 2 == 0 else n // 2 + 1
if k <= cut:
	print(2 * k - 1)
else:
	print((k - cut) * 2)


a = input()
a = a.split()
od = 0
ev = 0
if int(a[0]) % 2 == 0:
	od = ev = int(a[0]) / 2
else:
	od = int(a[0]) // 2
	od = od + 1
	ev = int(a[0]) // 2
if int(a[1]) <= od:
	print(2 * int(a[1]) - 1)
else:
	x = int(a[1]) - od
	print(int(2 * x))


s = [int(i) for i in input().split()]
n = s[0]
k = s[1]
if k <= n / 2 and n % 2 == 0:
	print(2 * k - 1)
if k <= n // 2 + 1 and n % 2 != 0:
	print(2 * k - 1)
if k > n / 2 and n % 2 == 0:
	print(2 * k - n)
if k > n // 2 + 1 and n % 2 != 0:
	print(2 * k - n - 1)


import sys, collections
input = sys.stdin.readline
(n, k) = map(int, input().split())
mi = (n + 1) // 2
if k <= mi:
	print(2 * k - 1)
else:
	print(2 * (k - mi))


import math
num = input()
arr = []
count = 0
for i in range(0, len(num)):
	if num[i] == ' ':
		arr.append(int(num[count:i]))
		count = i + 1
	elif i == len(num) - 1:
		arr.append(int(num[count:len(num)]))
if arr[0] - arr[1] >= math.floor(arr[0] / 2):
	result = 2 * arr[1] - 1
else:
	result = 2 * (arr[1] - math.ceil(arr[0] / 2))
print(result)


from math import floor, ceil
(n, k) = list(map(int, input().split()))
if k > ceil(n / 2):
	print(2 * floor(k - n / 2))
else:
	print(1 + 2 * (k - 1))


(s, r) = map(int, input().split())
a = (s + 1) // 2
print(2 * r - [1, 2 * a][r > a])


(n, k) = [int(i) for i in input().split()]
odds = (n + 1) // 2
evens = n // 2
if k <= odds:
	print(2 * k - 1)
else:
	print(2 * (k - odds))


(x, y) = [int(x) for x in input().split()]
k = (x + 1) // 2
c = [2 * (y - 1) + 1, 2 * y - 2 * k][y > k]
print(c)


(n, k) = [int(x) for x in input().split()]
i = n // 2
if n % 2 != 0:
	i = i + 1
p = n - i
if i >= k:
	print(2 * k - 1)
else:
	k = k - i
	print(2 * k)


a = input().split(' ')
n = int(a[0])
m = int(a[1])
if n % 2 == 1:
	odd = n // 2 + 1
	even = n // 2
else:
	odd = n // 2
	even = n // 2
if m <= odd:
	r = 2 * m - 1
else:
	m = m - odd
	r = 2 * m
print(r)


number = list(map(int, input().split()))
if number[0] % 2 == 0:
	if number[1] <= number[0] / 2:
		answer = int(2 * number[1] - 1)
	else:
		answer = int((number[1] - number[0] / 2) * 2)
elif number[1] <= (number[0] + 1) / 2:
	answer = int(2 * number[1] - 1)
else:
	answer = int((number[1] - (number[0] + 1) / 2) * 2)
print(answer)


import math
(num, pos) = map(int, input().split())
if pos <= math.ceil(num / 2):
	print(pos * 2 - 1)
elif num % 2 == 1:
	print(2 * pos - num - 1)
else:
	print(2 * pos - num)


(n, k) = list(map(int, input().split()))
li = []
c = 0
if n % 2 == 0:
	c = n // 2
else:
	c = n // 2 + 1
if k <= c:
	print(1 + (k - 1) * 2)
else:
	print(2 + (k - c - 1) * 2)


(n, b) = map(int, input().split())
k = (n + 1) // 2
if b <= k:
	print(b * 2 - 1)
else:
	print((b - k) * 2)


(n, k) = map(int, input().split())
if n % 2 == 0:
	a = n // 2
elif n % 2 != 0:
	a = n // 2 + 1
if k <= a:
	x = (k - 1) * 2 + 1
elif k > a:
	x = (k - a) * 2
print(x)


(n, m) = list(map(int, input().split()))
med = int(n / 2) + n % 2
if m - 1 < med:
	print((m - 1) * 2 + 1)
else:
	print((m - med) * 2)
print()


s = input().split(' ')
n = int(s[0])
k = int(s[1])
middle_odd = n % 2 == 1
selected_odd = k <= n // 2
if middle_odd and k * 2 == n + 1:
	print(n)
elif selected_odd:
	print(k * 2 - 1)
elif middle_odd:
	print((k - n // 2 - 1) * 2)
else:
	print((k - n // 2) * 2)


(n, k) = map(int, input().split())
mid = n // 2
if n % 2 == 1:
	mid += 1
a = 1
if k > mid:
	a = 2
	k = k - mid
print(a + (k - 1) * 2)


(n, m) = input().split()
n = int(n)
m = int(m)
if n % 2 == 0:
	mid = n / 2 + 1
	if m == mid:
		print(2)
	elif m > mid:
		print(int(2 * (m - n / 2)))
	elif m < mid:
		print(int(2 * m - 1))
if n % 2 != 0:
	mid = (n + 1) / 2
	if m == mid:
		print(n)
	elif m > mid:
		print(int(2 * (m - mid)))
	elif m < mid:
		print(int(n - 2 * (mid - m)))


def f(l):
	(n, k) = l
	odd = k <= (n + 1) // 2
	off = (k - 1) % ((n + 1) // 2) + 1
	return (off << 1) - 1 if odd else off << 1
l = list(map(int, input().split()))
print(f(l))


(n, k) = map(int, input().split())
q = n // 2 if not n % 2 else n // 2 + 1
if k > q:
	k -= q
	print(2 * k)
else:
	print(-1 + 2 * k)


(j, s) = map(int, input().split())
t = (j + 1) // 2
print(2 * s - [1, 2 * t][s > t])


(n, k) = map(int, input().split(' '))

def func():
	if n % 2 == 0:
		if k <= n // 2:
			return 2 * k - 1
		else:
			return 2 * (k - n // 2)
	elif k <= n // 2 + 1:
		return 2 * k - 1
	else:
		return 2 * (k - n // 2 - 1)
print(func())


(n, k) = map(int, input().split())
odd = n + 1 >> 1
if k <= odd:
	print((k << 1) - 1)
else:
	k -= odd
	print(k << 1)


(N, K) = input().split()
n = int(N)
k = int(K)
if n % 2 != 0:
	if k <= n // 2 + 1:
		print(1 + (k - 1) * 2)
	else:
		k = k - (n // 2 + 1)
		print(int(2 + (k - 1) * 2))
elif k <= n / 2:
	print(1 + (k - 1) * 2)
else:
	k = k - n / 2
	print(int(2 + (k - 1) * 2))


(n, k) = map(int, input().strip().split())
evenStart = n // 2 + 1 + n % 2
if k < evenStart:
	print(2 * k - 1)
else:
	ind = k - evenStart
	print(2 * (ind + 1))


(n, m) = input().split()
n = int(n)
m = int(m)
arr = []
import math
if n % 2 == 0:
	if m <= n / 2:
		print(int(2 * m - 1))
	else:
		k = m - n / 2
		print(int(2 * k))
elif m <= int(n / 2) + 1:
	print(int(2 * m - 1))
else:
	k = m - math.ceil(n / 2)
	print(int(2 * k))


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def main():
	(n, m) = mi()
	x = ceil(n / 2)
	if m > x:
		m -= x
		print(2 + (m - 1) * 2)
	else:
		print(1 + (m - 1) * 2)
main()


class CodeforcesTask318ASolution:

	def __init__(self):
		self.result = ''
		self.nums = []

	def read_input(self):
		self.nums = [int(x) for x in input().split(' ')]

	def process_task(self):
		if self.nums[0] % 2:
			if self.nums[1] <= (self.nums[0] + 1) / 2:
				self.result = str(int(self.nums[1] * 2 - 1))
			else:
				self.result = str(int((self.nums[1] - (self.nums[0] + 1) / 2) * 2))
		elif self.nums[1] <= self.nums[0] / 2:
			self.result = str(int(self.nums[1] * 2 - 1))
		else:
			self.result = str(int((self.nums[1] - self.nums[0] / 2) * 2))

	def get_result(self):
		return self.result
Solution = CodeforcesTask318ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


def abir():
	return map(int, input().split(' '))
n = list(abir())
x = n[0] // 2 + n[0] % 2
if n[1] <= x:
	print(2 * (n[1] - 1) + 1)
else:
	print((n[1] - x) * 2)


import math
numbers = input()
numbers = list(map(int, numbers.split()))
number = numbers[0]
position = numbers[1]
half = math.ceil(number / 2)
if number == 1:
	print(1)
elif position > half:
	position = position - half
	print(position * 2)
else:
	print(position * 2 - 1)


(x, m) = map(int, input().split())
if x % 2 == 1:
	if m <= x // 2 + 1:
		print(2 * (m - 1) + 1)
	else:
		m -= x // 2 + 1
		if m == 0:
			m += 1
		print(2 * m)
elif m <= x // 2:
	print(2 * (m - 1) + 1)
else:
	m -= x // 2
	if m == 0:
		m += 1
	print(2 * m)


n_k_string = input('')
n_k_list = list(n_k_string.split())
(n, k) = (int(n_k_list[0]), int(n_k_list[1]))
if n % 2 == 0:
	if k <= n / 2:
		print(2 * k - 1)
	else:
		print(2 * k - n)
elif k <= (n + 1) / 2:
	print(2 * k - 1)
else:
	print(2 * k - n - 1)


(n, k) = map(int, input().split())
num_sodo = n // 2
num_liho = n - num_sodo
if k <= num_liho:
	print(1 + 2 * (k - 1))
else:
	k = k - num_liho
	print(2 * k)


inn = input().split(' ')
nums = int(inn[0])
fnd = int(inn[1])
if nums % 2 == 0:
	evn = int(nums / 2)
else:
	evn = nums // 2 + 1
if fnd <= evn:
	print(fnd * 2 - 1)
else:
	print((fnd - evn) * 2)


(n, k) = map(int, input().split())
a = (n + 1) // 2
print(2 * k - [1, 2 * a][k > a])


string = input()
s = string.split(' ')
n = int(s[0])
k = int(s[1])
f = 2 * k - 1
if f > n:
	if n % 2 == 1:
		f = f - n
	else:
		f = f - n + 1
print(f)


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	(n, k) = [int(i) for i in input().split()]
	odds = (n + 1) // 2
	evens = n - odds
	if k > odds:
		k -= odds
		print(2 * k)
	else:
		print(2 * k - 1)

def main():
	tc = 1
	for case in range(tc):
		solve()
main()


line = input().split()
(n, k) = (int(line[0]), int(line[1]))
count_of_odd = 0
if n % 2 == 0:
	count_of_odd = n // 2
else:
	count_of_odd = n // 2 + 1
if k <= count_of_odd:
	print(2 * k - 1)
else:
	print(2 * (k - count_of_odd))


num1 = list(map(int, input().split()))
a = num1[0] % 2
b = num1[0] // 2
if a == 0 and num1[1] <= b:
	print(2 * num1[1] - 1)
if a == 0 and num1[1] > b:
	z = num1[1] - b
	print(2 * z)
if a == 1 and num1[1] <= b + 1:
	print(2 * num1[1] - 1)
if a == 1 and num1[1] > b + 1:
	z = num1[1] - b - 1
	print(2 * z)


try:
	(n, k) = map(int, input().split())
	if k <= (n + 1) // 2:
		print(k * 2 - 1)
	else:
		print((k - (n + 1) // 2) * 2)
except EOFError:
	pass


(x, y) = map(int, input().split())
a = int((x + 1) / 2)
if y <= a:
	print(y * 2 - 1)
else:
	y -= a
	print(y * 2)


mn = list(input().split(' '))
m = int(mn[0])
n = int(mn[1])
if m % 2 == 0:
	if n <= m // 2:
		print(n * 2 - 1)
	else:
		k = n - m // 2
		print(k * 2)
if m % 2 != 0:
	if n <= m // 2 + 1:
		print(n * 2 - 1)
	else:
		k = n - m // 2 - 1
		print(k * 2)


(x, y) = map(int, input().split())
z = y - (x + 1) // 2
print([2 * y - 1, 2 * z][z > 0])


def read_input():
	input_str = str(input())
	return map(int, input_str.split(' '))

def fount_false_prime_int(n: int, k: int) -> int:
	even_count = (n + 1) // 2
	if k <= even_count:
		return k * 2 - 1
	else:
		new_k = k - even_count
		return new_k * 2
(n, k) = read_input()
false_prime_int = fount_false_prime_int(n, k)
print(false_prime_int)


(n, pos) = map(int, input().split())
if n % 2 != 0:
	n = n + 1
temp = int(n / 2)
if pos > temp:
	minus = n - pos
	print(pos - minus)
else:
	adds = pos - 1
	print(pos + adds)


(n, k) = map(int, input().split())
import math
val = math.ceil(n / 2)
if k <= val:
	ans = k + k - 1
else:
	ans = k - (val - abs(val - k))
print(ans)


(n, k) = list(map(int, input().split()))
if n % 2 == 0:
	lenodd = int(n / 2)
	leneven = int(n / 2)
else:
	lenodd = int((n + 1) / 2)
	leneven = int((n - 1) / 2)
if k <= lenodd:
	AnsNo = k * 2 - 1
else:
	AnsNo = (k - lenodd) * 2
print(AnsNo)


(n, k) = map(int, input().split())
z = n // 2
if n % 2 == 1:
	z = z + 1
if k <= z:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - z))


import math
(n, pos) = map(int, input().split())
a = math.ceil(n / 2)

def odd(pos):
	return 2 * pos - 1
if pos >= 1 and pos <= a:
	print(odd(pos))
else:
	b = pos - a
	c = odd(b)
	print(c + 1)


(n, k) = map(int, input().split())
(odds_num, answer) = (0, 0)
if n % 2 == 0:
	odds_num = n / 2
else:
	odds_num = n // 2 + 1
if k <= odds_num:
	answer = k * 2 - 1
else:
	answer = (k - odds_num) * 2
print(int(answer))


import sys

def main():
	(n, k) = map(int, sys.stdin.readline().split())
	max_odd_pos = int(n / 2)
	if n % 2 == 1:
		max_odd_pos += 1
	if k <= max_odd_pos:
		print(k * 2 - 1)
	else:
		print((k - max_odd_pos) * 2)
sys.exit(main())


(cnt, pos) = map(int, input().split())
if pos <= (cnt + 1) // 2:
	print(2 * pos - 1)
else:
	pos -= (cnt + 1) // 2
	print(2 * pos)


def main():
	(n, k) = tuple(map(int, input().rstrip().split()))
	half = (n + 1) // 2
	if k <= half:
		print((k - 1) * 2 + 1)
	else:
		k -= half
		print(k * 2)
main()


import math

def method(inp):
	n = int(inp.split(' ')[0])
	k = int(inp.split(' ')[1])
	if 1 <= k and k <= n and (n <= 10 ** 12):
		if k > math.ceil(n / 2):
			k = k - math.ceil(n / 2)
			print(k * 2)
		else:
			print(k * 2 - 1)
method(input())


def Main():
	(n, k) = map(int, input().split())
	n_even = n // 2
	n_odd = (n + 1) // 2
	if k > (n + 1) // 2:
		print(2 * (k - (n + 1) // 2))
	else:
		print(2 * k - 1)
Main()


(a, b) = input().split()
n = int(a)
i = int(b)
if n % 2 == 0:
	x = int(n / 2)
else:
	x = int(n / 2) + 1
if i <= x:
	print(2 * i - 1)
else:
	print(2 * (i - x))


(n, back) = map(int, input().split())
if n % 2 == 0:
	ni = n // 2
else:
	ni = n // 2 + 1
if back > ni:
	print((back - ni) * 2)
else:
	print(back * 2 - 1)


(n, k) = [int(i) for i in input().split()]
from math import ceil
if n % 2 == 0 and k <= n // 2:
	print(2 * k - 1)
	exit(0)
if n % 2 == 0 and k > n // 2:
	print((k - n // 2) * 2)
	exit(0)
if n % 2 != 0 and k <= n // 2 + 1:
	print(2 * k - 1)
	exit(0)
if n % 2 != 0 and k > n // 2:
	print((k - n // 2 - 1) * 2)


(n1, p1) = input().split()
n = int(n1)
p = int(p1)
if n % 2 == 0:
	if p <= n / 2:
		print(2 * p - 1)
	else:
		print(int((p - n / 2) * 2))
elif p <= int(n / 2) + 1:
	print(2 * p - 1)
else:
	print(int((p - (int(n / 2) + 1)) * 2))


x = list(map(int, input().strip().split()))
n = x[0]
k = x[1]
result = 0
if n % 2 == 0:
	if k > n / 2:
		if n % 2 == 0:
			result = 2 * (k - n / 2)
		else:
			result = 2 * (k - n / 2) - 1
	else:
		result = 1 + 2 * (k - 1)
elif k > n / 2 + 1:
	if n % 2 == 0:
		result = 2 * (k - n / 2)
	else:
		result = 2 * (k - n / 2) - 1
else:
	result = 1 + 2 * (k - 1)
print(int(result))


(numberOfTerms, requiredPosition) = [int(ip) for ip in input().split(' ')]

def findNumberAtPosition(numberOfTerms, requiredPosition):
	if numberOfTerms % 2 == 0:
		numberOfOddTerms = numberOfTerms // 2
	else:
		numberOfOddTerms = (numberOfTerms + 1) // 2
	if requiredPosition <= numberOfOddTerms:
		return 2 * requiredPosition - 1
	else:
		return 2 * (requiredPosition - numberOfOddTerms)
print(findNumberAtPosition(numberOfTerms, requiredPosition))


import sys
import math
import bisect
import itertools

def solve(n, k):
	if n == 1:
		return 1
	nl = n // 2 + n % 2
	nr = n // 2
	if k <= nl:
		return k * 2 - 1
	else:
		return (k - nl) * 2

def main():
	(n, k) = map(int, input().split())
	print(solve(n, k))
main()


s = input().split()
if int(s[0]) % 2 == 0:
	if int(s[1]) > int(s[0]) / 2:
		a = (int(s[1]) - int(s[0]) / 2) * 2
	else:
		a = int(s[1]) * 2 - 1
elif int(s[1]) > int(s[0]) // 2 + 1:
	a = 2 * (int(s[1]) - int(s[0]) // 2 - 1)
else:
	a = int(s[1]) * 2 - 1
print(int(a))


from math import ceil
(d, e) = map(int, input().split())
odd = ceil(d / 2)
even = d // 2
if e <= odd:
	print(e * 2 - 1)
else:
	print(abs(odd - e) * 2)


(a, b) = map(int, input().split())
z = 1
x = 1
if a % 2 == 0 and 2 * b > a:
	z = 2
	b = b - a // 2
elif a % 2 != 0 and b > a // 2 + 1:
	z = 0
	b = b - a // 2
b = b * 2
z = z + b - 2
print(z)


import math
(n, k) = map(int, input().split())
e = 0
o = 0
if n % 2 == 0:
	o = int(n / 2)
if n % 2 != 0:
	o = int(math.ceil(n / 2))
if k > o:
	a2 = 2
	d2 = 2
	print(a2 + (k - o - 1) * d2)
elif k <= o:
	a1 = 1
	d1 = 2
	print(a1 + (k - 1) * d1)


(n, k) = map(int, input().split())
if n % 2 == 1:
	if k <= (n + 1) // 2:
		s = k * 2 - 1
	else:
		ind = k - (n + 1) // 2
		s = ind * 2
elif k <= n // 2:
	s = k * 2 - 1
else:
	ind = k - n // 2
	s = ind * 2
print(s)


(a, b) = (int(x) for x in input().split())
c = (a + 1) // 2
print([b * 2 - 1, (b - c) * 2][b > c])


(n, k) = list(map(int, input().split()))
if n % 2 != 0:
	oddnum = (n + 1) // 2
	evennum = oddnum - 1
else:
	oddnum = n // 2
	evennum = n // 2
if k <= oddnum:
	if k == 1:
		print('1')
	elif k == 2:
		print('3')
	else:
		print(k * 2 - 1)
else:
	k = k - oddnum
	print(2 * k)


(n, k) = map(int, input().split())
n2 = (n + 1) // 2
print(2 * k - 1 if k <= n2 else 2 * (k - n2))


(n, k) = map(int, input().split())
p = 0
s = 0
if n % 2 == 0:
	p = n // 2
else:
	p = n // 2 + 1
if p >= k:
	print(1 + (k - 1) * 2)
else:
	s = abs(k - p)
	print(2 + (s - 1) * 2)


def getNumber(n, k):
	if n % 2 == 0:
		pos = n // 2
	else:
		pos = n // 2 + 1
	if k <= pos:
		return k * 2 - 1
	else:
		return (k - pos) * 2
(n, k) = list(map(int, input().split()))
print(getNumber(n, k))


(n, k) = list(map(int, input().split()))
if n == 1:
	print(1)
	exit(0)
if n == k and n % 2 == 0:
	print(n)
	exit(0)
elif n == k and n % 2 != 0:
	print(n - 1)
	exit(0)
if n % 2 == 0:
	if 1 <= k <= n // 2:
		print(1 * k + (k - 1))
	else:
		print(2 * (k % (n // 2)))
else:
	r = n % 2 + n // 2
	if 1 <= k <= r:
		print(1 * k + (k - 1))
	else:
		print(2 * (k - r))


import math as m
(n, k) = map(int, input().split())
if k <= m.ceil(n / 2):
	print(2 * k - 1)
elif k > m.ceil(n / 2):
	print(2 * (k - m.ceil(n / 2)))


import math
string = input()
l = string.split(' ')
n = int(l[0])
k = int(l[1])
mid = math.ceil(n / 2)
if k <= mid:
	print(k * 2 - 1)
else:
	print((k - mid) * 2)


(n, k) = [int(i) for i in input().split()]
diff = abs(k - (n + 1) // 2)
if k <= (n + 1) // 2:
	if n % 2 == 1:
		x = n - diff * 2
	else:
		x = n - 1 - diff * 2
else:
	diff1 = abs(k - (n + 1) // 2 - 1)
	x = 2 + diff1 * 2
print(x)


from math import ceil
(n, k) = map(int, input().strip().split())
ans = 0
d = ceil(n / 2)
if k <= ceil(n / 2):
	ans = k * 2 - 1
else:
	x = k - d
	ans = x * 2
print(ans)


(n, k) = list(map(int, input().split(' ')))

def num_odd(n):
	N = n / 2
	if n % 2 != 0:
		N += 1
	return int(N)
if k > num_odd(n):
	k = k - num_odd(n)
	print(2 * k)
else:
	print(2 * k - 1)


(x, y) = input().split(' ')
x = int(x)
y = int(y)
q = int(y / x)
num = 0
if x % 2 == 0:
	if y <= int(x / 2):
		num = y * 2 - 1
		print(num)
	else:
		num = y - int(x / 2)
		num = num * 2
		print(num)
elif y <= int(x / 2) + 1:
	num = y * 2 - 1
	print(num)
else:
	num = y - int(x / 2) - 1
	num = num * 2
	print(num)


nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
if n % 2 == 0:
	half = n // 2
else:
	half = n // 2 + 1
if k <= half:
	print(2 * k - 1)
else:
	print(2 * (k - half))


import sys
s = sys.stdin.readline()
s = s.split()
s = [int(x) for x in s]
(n, k) = s
a = 0
try:
	if n % 2 == 1:
		a = n // 2 + 1
		if k > a:
			print(2 * (k - a))
		if k <= a:
			print(2 * k - 1)
	else:
		a = n // 2
		if k > a:
			print(2 * (k - a))
		if k <= a:
			print(2 * k - 1)
except SyntaxError:
	pass


a = list(input().split())
n = int(a[0])
k = int(a[1])
if k <= (n + 1) // 2:
	print(2 * k - 1)
if k > (n + 1) // 2:
	k = k - (n + 1) // 2
	print(2 * k)


(n, k) = [int(i) for i in input().split()]
if k <= round(n / 2 + 0.001):
	print(k * 2 - 1)
else:
	print((k - round(n / 2 + 0.001)) * 2)


import math
(n, k) = map(int, input().split())
if k <= math.floor((n + 1) / 2):
	print(2 * k - 1)
else:
	print((k - math.floor((n + 1) / 2)) * 2)


(a, b) = map(int, input().split())
if a % 2 == 0:
	k = a // 2
else:
	k = (a + 1) // 2
if b <= k and b >= 1:
	n = 2 * b - 1
if b > k and b >= 1:
	n = (b - k) * 2
print(n)


def even(midpoint, k):
	if k <= midpoint:
		return 1 + 2 * (k - 1)
	return 2 + 2 * (k - midpoint - 1)

def odd(midpoint, k):
	if k <= midpoint + 1:
		return 1 + 2 * (k - 1)
	return 2 + 2 * (k - midpoint - 2)
(n, k) = map(int, input().split())
midpoint = int(n / 2)
res = 0
if n % 2 == 0:
	print(even(midpoint, k))
else:
	print(odd(midpoint, k))


(a, b) = map(int, input().split())
c = a
if a % 2 != 0:
	c = a - 1
	if b <= a // 2 + 1:
		print(2 * b - 1)
	elif b > a // 2 + 1:
		print(c - (a - b) * 2)
elif b <= a // 2:
	print(2 * b - 1)
elif b > a // 2:
	print(c - (a - b) * 2)


w = input().split()
n = int(w[0])
k = int(w[1])
if n % 2 == 0:
	if k <= n // 2:
		print(2 * k - 1)
	else:
		g = k - n // 2
		print(g * 2)
elif k <= n // 2 + 1:
	print(2 * k - 1)
else:
	k = k - 1 - n // 2
	print(2 * k)


from math import ceil
(x, y) = map(int, input().split())
li = []
d = ceil(x / 2)
if d >= y:
	print(y + (y - 1))
else:
	y = y - d
	print(y + (y - 1) + 1)


(n, k) = map(int, input().split())
if k <= sum(divmod(n, 2)):
	print(k + k - 1)
else:
	print(k - (n - k) - n % 2)


def getNumber(n, k):
	if n % 2 == 0:
		pos = n // 2
	else:
		pos = n // 2 + 1
	if k <= pos:
		return k * 2 - 1
	else:
		return (k - pos) * 2
x = input()
x = x.split(' ')
(n, k) = (int(x[0]), int(x[1]))
print(getNumber(n, k))


import math
(n, k) = list(map(int, input().split()))
if n % 2 == 0:
	r = n // 2
	if k <= r:
		print(2 * k - 1)
	else:
		pos = k - r
		print(2 * pos)
else:
	r = math.ceil(n / 2)
	if k <= r:
		print(2 * k - 1)
	else:
		pos = k - r
		print(2 * pos)


def evenodds(n, k):
	if n % 2 == 0:
		pivot = int(n / 2)
	else:
		pivot = int((n + 1) / 2)
	if k <= pivot:
		return 2 * k - 1
	else:
		return 2 * (k - pivot)
line1 = input()
n_arg = int(line1.split()[0])
k_arg = int(line1.split()[1])
print(evenodds(n_arg, k_arg))


import math
(n, k) = [int(c) for c in input().rstrip().split(' ')]
ans = 0
sep = math.ceil(n / 2)
if k <= sep:
	ans = 2 * (k - 1) + 1
else:
	ans = 2 * (k - sep)
print(ans)


from math import ceil as c
(n, k) = map(int, input().split())
l = [2 * (k - c(n / 2)), 2 * k - 1]
print(l[k <= c(n / 2)])


data = input().split(' ')
j = int(data[0])
k = int(data[1])
if j % 2 == 0:
	if k <= j // 2:
		result = -1 + 2 * k
	else:
		result = 2 * k - j
elif k <= (j + 1) // 2:
	result = -1 + 2 * k
else:
	result = 2 * k - (j + 1)
print(result)


from math import ceil
(n, k) = map(int, input().split())

def odd(l):
	return 2 * l - 1

def even(l):
	return 2 * l
if k <= ceil(n / 2):
	print(odd(k))
else:
	print(even(k - ceil(n / 2)))


def round_half_up(num):
	if num - int(num) >= 0.5:
		return int(num + 0.5)
	else:
		return int(num)
(n, k) = [int(x) for x in input().split()]
if k <= round_half_up(n / 2):
	print(1 + 2 * (k - 1))
else:
	k = k - round_half_up(n / 2)
	print(2 + 2 * (k - 1))


(n, k) = map(int, input().split())
if n % 2 == 0:
	part = n // 2
else:
	part = n // 2 + 1
if k <= part:
	output = 2 * k - 1
else:
	output = (k - part) * 2
print(output)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
halfNumber = n / 2
isOdd = k <= halfNumber
if isOdd:
	res = 2 * k - 1
else:
	res = int(k - halfNumber) * 2
if res == 0:
	print(n)
else:
	print(res)


(n, k) = [int(inp) for inp in input().split(' ')]
odds_largest = n if n % 2 == 1 else n - 1
odds_count = (odds_largest - 1) // 2 + 1
if k <= odds_count:
	print(2 * k - 1)
else:
	print(2 * (k - odds_count))


(n, k) = map(int, input().split())
d = __import__('math').ceil(n / 2)
print(2 * k - 1 if k <= d else 2 * (k - d))


s = input('')
(n, k) = s.split(' ')
n = int(n)
k = int(k)
if int(n % 2) == 0:
	odd = int(n / 2)
	even = int(n / 2)
else:
	odd = int(n / 2 + 1)
	even = int(n / 2)
if k <= odd:
	value = 2 * (k - 1) + 1
else:
	value = 2 * (k - odd)
print(value)


def print_num(n, k):
	no_odd = n // 2
	if n % 2:
		no_odd += 1
	if k <= no_odd:
		return 2 * k - 1
	else:
		return 2 * (k - no_odd)
(n, k) = map(int, input().split())
print(print_num(n, k))


numbers = input()
numbers = numbers.strip().split(' ')
(seq, pos) = (int(numbers[0]), int(numbers[1]))
if seq % 2 == 0:
	if pos <= seq / 2:
		print(2 * pos - 1)
	else:
		print(int((pos - seq / 2) * 2))
elif pos <= seq / 2 + 1:
	print(2 * pos - 1)
else:
	print(int((pos - 1 - int(seq / 2)) * 2))


(n, position) = map(int, input().split(' '))

def oddsCount(n):
	if n % 2 == 0:
		return n // 2
	return n // 2 + 1

def evensCount(n):
	if n % 2 == 0:
		return n // 2
	return n - odds(n)

def findingNumber(position, n):
	if position > oddsCount(n):
		return (position - oddsCount(n)) * 2
	return 2 * position - 1
print(findingNumber(position, n))


import sys
from math import ceil
from functools import reduce
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
cin = lambda : int(read())
(n, k) = mi()
if k <= ceil(n / 2):
	k -= 1
	print(2 * k + 1)
else:
	k -= ceil(n / 2)
	print(2 * k)


(p, s) = [int(x) for x in input().split()]
if p % 2 == 0:
	p1 = p // 2
else:
	p1 = p // 2 + 1
if s <= p1:
	print(2 * s - 1)
else:
	print((s - p1) * 2)


from sys import stdin, stdout
I = lambda : stdin.readline().strip()
read = lambda : list(map(int, input().split()))
(n, k) = read()
edge = sum(divmod(n, 2))
if k <= edge:
	print(2 * k - 1)
else:
	print(2 * (k - edge))


import math
a = [int(x) for x in input().split()]
if a[1] > math.ceil(a[0] / 2):
	print(2 * abs(a[1] - math.ceil(a[0] / 2)))
else:
	print(1 + 2 * a[1] - 2)


reg = input().split()
n = int(reg[0])
k = int(reg[1])
if k <= (n + 1) // 2:
	print((k - 1) * 2 + 1)
else:
	k -= (n + 1) // 2
	print(k * 2)


from math import ceil
s = input()
(n, k) = [int(i) for i in s.split()]

def isEven(x):
	if x % 2 == 0:
		return True
	else:
		return False
if isEven(n):
	base = n - 1
	baseIndex = n / 2
else:
	base = n
	baseIndex = ceil(n / 2)
if k <= baseIndex:
	print(k + k - 1)
else:
	print(k + k - 1 - base)


from sys import stdin
(n, k) = map(int, stdin.readline().strip().split())
print(k * 2 - 1 if k * 2 - 1 <= n else k * 2 - (n & 1) - n)


(n, k) = input().split()
(n, k) = [int(n), int(k)]
if n % 2 == 0:
	if k <= n / 2:
		print(k * 2 - 1)
	else:
		print((k - int(n / 2)) * 2)
else:
	_n = n // 2 + 1
	if k <= _n:
		print(k * 2 - 1)
	else:
		print((k - _n) * 2)


from sys import stdin, stdout
import math
(n, k) = map(int, stdin.readline().split())
if k == math.ceil(n / 2) and n % 2 == 1:
	print(n)
	exit()
if k <= n // 2:
	print(k * 2 - 1)
else:
	n_2 = math.ceil(n / 2)
	print((k - n_2) * 2)


(x, y) = map(int, input().split())
if x % 2 == 0:
	o = x / 2
	if y <= o:
		z = y * 2 - 1
		print(int(z))
	if y > o:
		z = (y - o) * 2
		print(int(z))
if x % 2 != 0:
	o = (x + 1) / 2
	if y <= o:
		z = y * 2 - 1
		print(int(z))
	if y > o:
		z = (y - o) * 2
		print(int(z))


data = input().split(' ')
n = int(data[0])
k = int(data[1])
if n % 2 == 0:
	num_odd = n / 2
else:
	num_odd = (n + 1) / 2
if k <= num_odd:
	print(int(2 * k - 1))
else:
	print(int(2 * (k - num_odd)))


(n, k) = input().split()
n = int(n)
k = int(k)
if n % 2 == 0:
	o = n // 2
else:
	o = n // 2 + 1
if k > o:
	print((k - o) * 2)
else:
	print(k * 2 - 1)


(x, y) = map(int, input().split())
t = (x + 1) // 2
if y <= t:
	c = 2 * y - 1
else:
	r = y - t
	c = 2 * r
print(c)


import sys
userInput = sys.stdin.readlines()
a = list(map(int, userInput[0][:-1].split(' ')))
(n, k) = (a[0], a[1])
(odds, evens) = ((n + 1) // 2, n // 2)
if k <= odds:
	print(int(k * 2) - 1)
else:
	print(int((k - odds) * 2))


(n, index) = map(int, input().split())
mid = n // 2 + n % 2
print(2 * index - 1 if index <= mid else (index - mid) * 2)


import math
(size, position) = map(int, input().strip().split())
if size % 2 == 0:
	if position <= size / 2:
		print(int(1 + 2 * (position - 1)))
	else:
		print(int(2 + 2 * (position - size / 2 - 1)))
elif position <= math.ceil(size / 2):
	print(int(1 + 2 * (position - 1)))
else:
	print(int(2 + 2 * (position - math.ceil(size / 2) - 1)))


x = list(map(int, input().split(' ')))
from math import ceil
n = ceil(x[0] / 2)
counter = 0
if x[1] > n:
	counter = (x[1] - n) * 2
else:
	counter = x[1] * 2 - 1
print(counter)


(a, b) = list((int(x) for x in input().split()))
if a % 2 == 0:
	m = a // 2
else:
	m = a // 2 + 1
if b <= m:
	print((b - 1) * 2 + 1)
else:
	print((b - m) * 2)


import sys

def calK(num, kth):
	if num % 2 == 0:
		if kth > num / 2:
			return 2 * (kth - num // 2)
		else:
			return 1 + 2 * (kth - 1)
	elif kth > num // 2 + 1:
		return 2 * (kth - (num // 2 + 1))
	else:
		return 1 + 2 * (kth - 1)

def main():
	(n, k) = map(int, sys.stdin.readline().strip().split())
	print(calK(n, k))
main()


(no, find) = map(int, input().split())
if no % 2 == 0:
	a = int(no / 2)
	if find <= a:
		print(2 * find - 1)
	else:
		print(2 * (find - a))
else:
	a = int(no / 2 + 1)
	if find <= a:
		print(2 * find - 1)
	else:
		print(2 * (find - a))


s = input()
list1 = s.split()
n = int(list1[0])
k = int(list1[1])
if n % 2 != 0:
	h = (n + 1) / 2
	if k > h:
		k = k - h
		print(int(2 * k))
	else:
		print(int(2 * k - 1))
else:
	h = n / 2
	if k > h:
		k = k - h
		print(int(2 * k))
	else:
		print(int(2 * k - 1))


(n, k) = map(int, input().split())
(a, d) = (-1, -1)
if n % 2 == 0:
	if k <= n // 2:
		a = 1
		d = 2
	else:
		a = 2
		d = 2
		k = k - n // 2
	res = a + (k - 1) * d
	print(res)
else:
	if k <= n // 2 + 1:
		a = 1
		d = 2
	else:
		a = 2
		d = 2
		k = k - (n // 2 + 1)
	res = a + (k - 1) * d
	print(res)


temp = input().split(' ')
(n, k) = (int(temp[0]), int(temp[1]))
lim = int(n / 2 + 1 / 2)
res = lambda x: k * 2 - 1 if k <= lim else (k - lim) * 2
print(res(k))


def DivideRoundUp(x, y):
	if x % y != 0:
		return x // y + 1
	else:
		return x / y
ar = [int(i) for i in input().split()]
a = ar[0]
b = ar[1]
if DivideRoundUp(a, 2) >= b:
	print(b * 2 - 1)
else:
	print(int((b - DivideRoundUp(a, 2)) * 2))


from math import ceil
(n, k) = [int(j) for j in input().split()]
if k <= ceil(n / 2):
	print(2 * k - 1)
else:
	print(2 * (k - ceil(n / 2)))


from math import *
n = input().split(' ')
a = ceil(int(n[0]) / 2)
if int(n[1]) <= a:
	print(1 + 2 * (int(n[1]) - 1))
else:
	d = int(n[1]) - a
	print(d * 2)


import sys
import math
import collections
from collections import deque
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))
T = 1
for _ in range(T):
	(n, k) = list(map(int, stdin.readline().split()))
	if n % 2 == 0:
		m = n // 2
		if k <= m:
			print(2 * (k - 1) + 1)
		else:
			print(2 * (k - m))
	else:
		m = n // 2 + 1
		if k <= m:
			print(2 * (k - 1) + 1)
		else:
			print(2 * (k - m))


(n, k) = map(int, input().split())
if n % 2 == 1:
	n += 1
lastOdd = n / 2
if k <= lastOdd:
	print(int(k * 2 - 1))
else:
	print(int((k - lastOdd) * 2))


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def btod(n):
	return int(n, 2)

def dtob(n):
	return bin(n).replace('0b', '')

def solution():
	(n, k) = Mint()
	t = ceil(n / 2)
	if k <= t:
		print(2 * k - 1)
	else:
		print(2 * k - 2 * t)
solution()


(n, k) = [int(x) for x in input().split()]
if k <= n / 2 + 0.5:
	print(2 * k - 1)
else:
	half = -(-(n / 2) // 1)
	print(int((k - half) * 2))


(n, m) = map(int, input().split())
if n % 2 == 0 and m > n // 2:
	print((m - n // 2) * 2)
elif n % 2 == 1 and m > n // 2 + 1:
	print((m - n // 2 - 1) * 2)
elif n % 2 == 0 and m <= n // 2:
	print(m * 2 - 1)
elif n % 2 == 1 and m <= n // 2 + 1:
	print(m * 2 - 1)


(N, K) = [int(x) for x in input().split()]
if N % 2 == 0:
	lastodd = N // 2
	if K <= lastodd:
		print(2 * K - 1)
	else:
		K -= lastodd
		print(2 * K)
else:
	lastodd = N // 2 + 1
	if K <= lastodd:
		print(2 * K - 1)
	else:
		K -= lastodd
		print(2 * K)


import math
(n, k) = map(int, input().split())
chet = int(n / 2)
nechet = math.ceil(n / 2)
if k <= nechet:
	print(-1 + k * 2)
else:
	print((k - nechet) * 2)


list_even_odd = []
(n, k) = map(int, input().split())
if n % 2 == 0 and k <= n // 2:
	res = 2 * k - 1
	print(res)
elif n % 2 == 0 and k > n // 2:
	res = 2 * (k - n // 2)
	print(res)
if n % 2 != 0 and k <= (n + 1) // 2:
	res = res = 2 * k - 1
	print(res)
elif n % 2 != 0 and k > (n + 1) // 2:
	res = 2 * (k - (n + 1) // 2)
	print(res)


(num1, num2) = map(int, input().split())
print([2 * (num2 - (num1 + 1) // 2), 2 * num2 - 1][num2 <= (num1 + 1) // 2])


import math
(n, index) = map(int, input().split())
odd = (n - 1 + 2) / 2
even = n / 2
if index <= odd:
	answer = 2 * index - 1
else:
	answer = 2 * (index - int(odd))
print(answer)


def solve(n, k):
	first_half = (n + 1) // 2
	if k <= first_half:
		return 2 * k - 1
	else:
		return 2 * (k - first_half)

def main():
	[n, k] = [int(i) for i in input().strip().split()]
	result = solve(n, k)
	print(result)
main()


(num, i) = map(int, input().split())
(o, e) = ((num + 1) // 2, num // 2)
if i <= o:
	print(int(i * 2) - 1)
else:
	print(int((i - o) * 2))


import sys
(n, k) = map(int, sys.stdin.readline().split())
half = (n + 1) // 2
if k <= half:
	print(2 * k - 1)
else:
	print(2 * (k - half))


import math

def n_odd(n):
	return 2 * (n - 1) + 1

def n_even(n):
	return 2 * n

def main():
	(n, k) = map(int, input().split())
	number_of_odd = math.ceil(n / 2)
	if k <= number_of_odd:
		print(n_odd(k))
	else:
		print(n_even(k - number_of_odd))
main()


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
from collections import defaultdict as df
import heapq
infinite = float('inf')
(n, k) = RI()
if k <= (n + 1) // 2:
	print(2 * k - 1)
else:
	k -= (n + 1) // 2
	print(2 * k)


import math
(n, k) = [int(val) for val in input().split()]
median = math.ceil(n / 2)
if k <= median:
	print(k * 2 - 1)
else:
	print(2 * (k - median))


import sys
import math

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, k) = ninp()
if n % 2 == 0:
	if k <= n // 2:
		ans = k * 2 - 1
	else:
		k = k - n // 2
		ans = k * 2
elif k <= n // 2 + 1:
	ans = k * 2 - 1
else:
	k = k - (n // 2 + 1)
	ans = k * 2
print(ans)


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math
(n, k) = mi()
if k <= math.ceil(n / 2):
	ans = k * 2 - 1
else:
	ans = 2 * (k - math.ceil(n / 2))
print(ans)


line = input()
line = line.split()
n = int(line[0])
k = int(line[1])
nodds = 0
if n // 2 == n / 2:
	nodds = n // 2
else:
	nodds = n // 2 + 1
if k <= nodds:
	sum = 1 + (k - 1) * 2
else:
	k = k - nodds
	sum = k * 2
print(sum)


(n, k) = map(int, input().split())
todd = n // 2 + n % 2
if k <= todd:
	print(2 * k - 1)
else:
	print((k - todd) * 2)


import sys, math

def multiple_input():
	return map(int, sys.stdin.readline().strip().split())

def list_input():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, k) = multiple_input()
mid = math.ceil(n / 2)
if k > mid:
	print(2 * (k - mid))
else:
	print(2 * k - 1)


import math
(l, k) = [int(i) for i in input().split()]
if k <= math.ceil(l / 2):
	print(int(2 * k - 1))
else:
	print(int(2 * (k - math.ceil(l / 2))))


(x, y) = map(int, input().strip().split())
if x % 2 == 0:
	num = int(x / 2)
elif x % 2 == 1:
	num = int((x + 1) / 2)
if y <= num:
	print(2 * y - 1)
else:
	print(2 * (y - num))


def fun(n, k):
	if k <= n // 2 + n % 2:
		print(2 * k - 1)
	else:
		print(2 * (k - (n // 2 + n % 2)))
(n, k) = map(int, input().split())
fun(n, k)


x = input().split()
a = int(x[0])
b = int(x[1])
if a % 2 == 0:
	l = a // 2
else:
	l = a // 2 + 1
if b <= l:
	s = 1 + (b - 1) * 2
else:
	s = 2 + (b - l - 1) * 2
print(s)


import math
inp = lambda : map(int, input().split())
(n, k) = inp()
div = math.ceil(n / 2)
if k <= div:
	print(2 * k - 1)
else:
	print(2 * (k - div))


(a, b) = input().split()
(a, b) = (int(a), int(b))
if a % 2 == 0:
	if b <= a // 2:
		z = 1 + (b - 1) * 2
	if b > a // 2:
		z = 2 + (b - (a // 2 + 1)) * 2
if a % 2 != 0:
	if b <= a // 2 + 1:
		z = 1 + (b - 1) * 2
	if b > a // 2 + 1:
		z = 2 + (b - (a // 2 + 2)) * 2
print(z)


def num(a, b):
	if b < a / 2 + 1:
		return b * 2 - 1
	elif a == b:
		if a % 2 == 0:
			return b
		else:
			return b - 1
	else:
		b = b - a // 2
		if a % 2 == 0:
			return b * 2
		else:
			return b * 2 - 2
(x, y) = map(int, input().split(' '))
print(num(x, y))


a = input().split()
m = int(a[0])
n = int(a[1])
if m % 2 == 0 and n > m // 2:
	d = (n - m // 2) * 2
elif m % 2 == 0 and n <= m // 2:
	d = 2 * n - 1
elif m % 2 != 0 and n <= m // 2 + 1:
	d = 2 * n - 1
elif m % 2 != 0 and n > m // 2 + 1:
	d = (n - m // 2 - 1) * 2
print(d)


from math import ceil as c
(a, b) = map(int, input().split())
print(2 * b - 1 if a >= 2 * b - 1 else c(b - c(a / 2)) * 2)


import math
nk = input().split()
n = int(nk[0])
k = int(nk[1])

def findNum(k, oddEnd):
	if k > oddEnd:
		num = (k - oddEnd) * 2
	else:
		num = k * 2 - 1
	return num

def evenOdd(n, k):
	if n % 2 == 1:
		oddEnd = math.ceil(n / 2)
		num = findNum(k, oddEnd)
	else:
		oddEnd = n / 2
		num = findNum(k, oddEnd)
	return int(num)
res = evenOdd(n, k)
print(res)


(n, k) = map(int, input().split())
oddIndex = (n + 1) // 2
if oddIndex >= k:
	print(2 * k - 1)
else:
	print((k - oddIndex) * 2)


(g, h) = map(int, input().split())
(o, e) = ((g + 1) // 2, g // 2)
if h <= o:
	print(int(h * 2) - 1)
else:
	print(int((h - o) * 2))


(y, z) = input().split()
if int(y) % 2 == 0:
	a = int(y) // 2
else:
	a = int(y) // 2 + 1
if int(z) > a:
	x = int(z) - a
	q = x * 2
	print(q)
else:
	x = int(z) * 2 - 1
	print(x)


def pos(x, y):
	if x % 2 == 0:
		if y <= x // 2:
			return 2 * y - 1
		else:
			return 2 * y - x
	elif y <= x // 2 + 1:
		return 2 * y - 1
	else:
		return 2 * y - x - 1
(x, y) = map(int, input().split())
print(pos(x, y))


from math import ceil
a = input().split()
b = [int(i) for i in a]
n = b[0]
k = b[1]
c = ceil(n / 2)
if k > c:
	k = k - c
	print(2 * k)
else:
	print(2 * k - 1)


b = list(map(int, input().split()))
if b[0] % 2 == 1:
	k = b[0] // 2 + 1
	if b[1] > k:
		print((b[1] - k) * 2)
	else:
		print(2 * b[1] - 1)
else:
	k = b[0] // 2
	if b[1] > k:
		print((b[1] - k) * 2)
	else:
		print(2 * b[1] - 1)


import math
array = list(map(int, input().split(' ')))
(n, k) = (array[0], array[1])
m = math.ceil(n / 2.0)
if k <= m:
	print(2 * k - 1)
else:
	print(2 * (k - m))


(a, b) = map(int, input().split())
t = a // 2
if a % 2 == 0:
	if b <= t:
		s = 2 * b - 1
	if b > t:
		s = 2 * (b - t)
if a % 2 != 0:
	if b <= t + 1:
		s = 2 * b - 1
	if b > t + 1:
		s = 2 * (b - t - 1)
print(s)


(n, k) = map(int, input().split())
ev = n // 2
od = n - ev
if k <= od:
	an = 1 + (k - 1) * 2
else:
	k -= od
	an = 2 + (k - 1) * 2
print(an)


n = input()
(n, k) = n.strip().split()
(n, k) = (int(n), int(k))
if n % 2 == 0:
	lihih = n // 2
else:
	lihih = n // 2 + 1
if k <= lihih:
	print(2 * (k - 1) + 1)
else:
	k2 = k - lihih
	print(2 * k2)


mn = [int(i) for i in input().split()]
m = mn[0]
n = mn[1]
if m % 2 == 0:
	if n <= m / 2:
		number = 2 * n - 1
	else:
		number = 2 * (n - m / 2)
elif n <= m // 2 + 1:
	number = 2 * n - 1
else:
	number = 2 * (n - m // 2 - 1)
print(int(number))


x = input().split(' ')
n = eval(x[0])
k = eval(x[1])
if n % 2 == 0:
	if k <= n / 2:
		print(2 * k - 1)
	else:
		print(2 * k - n)
elif k <= n // 2 + 1:
	print(2 * k - 1)
else:
	print(2 * k - n - 1)


def main():
	from math import ceil
	[n, k] = [int(_) for _ in input().split()]
	n_odds = ceil(n / 2)
	print(k * 2 - 1 if k <= n_odds else (k - n_odds) * 2)
main()


inputs = input().split(' ')
(n, k) = (int(inputs[0]), int(inputs[1]))
last_even_index = n
if n % 2 == 0:
	last_odd_index = (n - 1 - 1) // 2 + 1
else:
	last_odd_index = (n - 1) // 2 + 1
if k <= last_odd_index:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - last_odd_index))


def getnum(n, k):
	k = k - 1
	highodd = n // 2
	if not n % 2:
		highodd -= 1
	if k <= highodd:
		return 2 * k + 1
	return 2 * (k - highodd)
(n, k) = tuple(map(int, input().split()))
print(getnum(n, k))


x = input().split()
x1 = int(x[0])
x2 = int(x[1])
if x2 > (x1 + 1) // 2:
	z = 2 * (x2 - (x1 + 1) // 2)
else:
	z = 2 * x2 - 1
print(z)


(m, n) = map(int, input().split())
kq = 2 * (n - 1) + 1
if kq > m:
	n = n - (m + 1) // 2
	kq = 2 * n
print(kq)


def even_odds(n, m):
	if n % 2 == 0:
		if m <= n / 2:
			return 1 + (m - 1) * 2
		else:
			return int((m - n / 2) * 2)
	elif m <= int(n / 2) + 1:
		return 1 + (m - 1) * 2
	else:
		return int((m - (int(n / 2) + 1)) * 2)
(n, m) = map(int, input().split())
print(even_odds(n, m))


(n, k) = map(int, input().split())
import math
seperation = math.ceil(0.5 * n)
if k <= seperation:
	print(2 * k - 1)
else:
	print(2 * (k - seperation))


a = list(map(int, input().split()))
if a[0] % 2 == 0:
	k = int(a[0] / 2)
else:
	k = int(a[0] / 2) + 1
if a[1] <= k:
	print(2 * a[1] - 1)
else:
	d = a[1] - k
	print(2 * d)


(n, k) = map(int, input().split())
last_of_odds = (n + 1) // 2
if k <= last_of_odds:
	print(2 * k - 1)
else:
	k -= last_of_odds
	print(2 * k)


(n, m) = map(int, input().split())
if n % 2 == 0:
	odd = n // 2
else:
	odd = n // 2 + 1
if m <= odd:
	print(2 * m - 1)
if m > odd:
	even = m - odd
	print(2 * even)


(n, k) = list(map(int, input().strip().split()))
half_point = int((n - 1) / 2) + 1 if n % 2 == 1 else int(n / 2)
is_odd = True if k <= half_point else False
if is_odd:
	print(k * 2 - 1)
else:
	print((k - half_point) * 2)


import math

def number(n, pos):
	if pos <= math.ceil(n / 2):
		num = 1 + (pos - 1) * 2
	else:
		num = 2 + (pos - math.ceil(n / 2) - 1) * 2
	return num
(n, pos) = map(int, input().split())
num = number(n, pos)
print(num)


(x, y) = input().split()
n = int(x)
k = int(y)
if k <= (n + 1) / 2:
	print(k * 2 - 1)
else:
	s = k - int((n + 1) / 2)
	print(s * 2)


input_s = input().split(' ')
a = int(input_s[0])
b = int(input_s[1])
half_a = a // 2 + a % 2
if b <= half_a:
	print(b * 2 - 1)
else:
	print((b - half_a) * 2)


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1
res = 0
x = read_array()
n = x[0]
k = x[1]
if n % 2 == 0:
	if k > n // 2:
		res = (k - n // 2) * 2
	else:
		res = 2 * k - 1
elif k > n // 2 + 1:
	res = (k - n // 2 - 1) * 2
else:
	res = 2 * k - 1
print(res)


String = input().split()
n = int(String[0])
k = int(String[1])
if n % 2 == 0:
	middle = n / 2
else:
	middle = int(n / 2 + 1)
if k > middle:
	k -= middle
	print(int(2 * k))
else:
	print(int(2 * k - 1))


l = list(map(int, input().split()))
(n, k) = (l[0], l[1])
if n % 2 == 0:
	p = n // 2
	if k - 1 < p:
		q = k - 1
		print(2 * q + 1)
	else:
		q = k - p
		print(2 * q)
else:
	p = n // 2 + 1
	if k - 1 < p:
		q = k - 1
		print(2 * q + 1)
	else:
		q = k - p
		print(2 * q)


(n, k) = map(int, input().split())
if k <= int((n + n % 2) / 2):
	print(2 * (k - 1) + 1)
else:
	tmp = k - int(n / 2) - n % 2
	print(2 * tmp)


(n, k) = map(int, input().split())
d = 1
m = 0
f = 0
if n % 2 == 1:
	m = (n + 1) / 2
	if k <= m:
		d = k * 2 - 1
	else:
		f = k - m
		d = f * 2
else:
	m = n / 2
	if k <= m:
		d = k * 2 - 1
	else:
		f = k - m
		d = f * 2
print(int(d))


def solve():
	(n, k) = [int(x) for x in input().split()]
	if n % 2 == 0:
		odd_count = n // 2
	else:
		odd_count = n // 2 + 1
	if k > odd_count:
		res = int(2 * (k - odd_count))
	else:
		res = int(1 + 2 * (k - 1))
	print(res)
	return
solve()


z = list(map(int, input().split()))
if z[0] % 2 == 0:
	z[0] = int(z[0] / 2)
	if z[1] <= z[0]:
		print(z[0] * 2 - (z[0] - z[1]) * 2 - 1)
	else:
		print(z[0] * 2 - (z[0] * 2 - z[1]) * 2)
else:
	v = int(z[0] / 2) + 1
	if z[1] <= v:
		print(v * 2 - 1 - (v - z[1]) * 2)
	else:
		v = int(z[0] / 2) + 1
		if z[0] == z[1]:
			print(z[0] - 1)
		else:
			print(z[0] - (z[0] - z[1]) * 2 - 1)


line = [int(i) for i in str(input()).split()]
half1 = line[0] // 2
half2 = line[0] - half1
if line[0] % 2 == 0:
	if line[1] <= half1:
		print((line[1] - 1) * 2 + 1)
	else:
		print((line[1] - half1) * 2)
elif line[1] <= half2:
	print((line[1] - 1) * 2 + 1)
else:
	print((line[1] - half2) * 2)


import math
x = input().split()
ni = math.floor(int(x[0]) / 2 + 0.5)
k = int(x[1])
if k <= ni:
	print(2 * k - 1)
else:
	print(2 * (k - ni))


inp = input().split()
t = int(inp[0])
ind = int(inp[1])
eve = t // 2
od = t - eve
if ind > od:
	num = 2 * (ind - od)
	print(str(num))
else:
	num = 2 * ind - 1
	print(str(num))


def evenodd(n, k):
	half = int(n / 2)
	if n % 2 != 0:
		half += 1
	if k <= half:
		k = 2 * k - 1
		print(int(k))
	else:
		k = (k - half) * 2
		print(int(k))
(n, k) = map(int, input().split())
evenodd(n, k)


def find(a, t):
	ans = a + (t - 1) * 2
	return ans
(n, k) = map(int, input().split())
if n % 2 == 1:
	if k <= n // 2 + 1:
		print(find(1, k))
	else:
		print(find(2, k - (n // 2 + 1)))
elif k <= n // 2:
	print(find(1, k))
else:
	print(find(2, k - n // 2))


def main():
	(n, k) = map(int, input().split())
	o = (n - 1) // 2 + 1
	e = (n - 1) // 2 + 1
	if k <= o:
		ans = 1 + (k - 1) * 2
	else:
		f = k - o
		ans = 2 + (f - 1) * 2
	print(ans)
main()


(n, k) = map(int, input().split())
nechet = n // 2 + n % 2
chet = n // 2
if k <= nechet:
	print(k * 2 - 1)
else:
	print((k - nechet) * 2)


def find(maximum: int, pos: int) -> int:
	odds = maximum // 2 + 1 if maximum % 2 != 0 else maximum // 2
	if pos <= odds:
		return pos * 2 - 1
	else:
		return (pos - odds) * 2
(n, k) = map(int, input().split())
print(find(n, k))


(n, k) = map(int, input().split())
list = []
if n % 2 == 0:
	odd_num = n // 2
else:
	odd_num = (n + 1) // 2
if k <= odd_num:
	output = k * 2 - 1
else:
	output = (k - odd_num) * 2
print(output)


(m, n) = map(int, input().split())
import math
a = []
if n <= math.floor((m + 1) / 2):
	print(2 * n - 1)
else:
	print(2 * (n - math.floor((m + 1) / 2)))


(n, k) = list((int(a) for a in input().split()))
if n & 1:
	if k <= (n >> 1) + 1:
		print(2 * k - 1)
	else:
		k -= (n >> 1) + 1
		print(2 * k)
elif k <= n >> 1:
	print(2 * k - 1)
else:
	k -= n >> 1
	print(2 * k)


def eveod(j, h):
	if j % 2 == 0:
		h = j // 2
	else:
		h = j // 2 + 1
	return h
(j, h) = list(map(int, input().split()))
s = eveod(j, h)
if h <= s:
	print(2 * h - 1)
else:
	print(2 * (h - s))


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, k) = get_ints()
if n & 1:
	mid = n // 2
	if k - 1 <= mid:
		print(2 * (k - 1) + 1)
	else:
		print((k - 1 - mid) * 2)
else:
	mid = n // 2 - 1
	if k - 1 <= mid:
		print(2 * (k - 1) + 1)
	else:
		print((k - mid - 1) * 2)


arr = input().split()
if int(arr[0]) % 2 == 0:
	if int(arr[1]) > int(arr[0]) / 2:
		print(int((int(arr[1]) - int(arr[0]) / 2) * 2))
	else:
		print(int(2 * int(arr[1]) - 1))
elif int(arr[1]) > int(arr[0]) / 2 + 1:
	print(int((int(arr[1]) - int(arr[0]) / 2) * 2 - 1))
else:
	print(int(2 * int(arr[1]) - 1))


(n, k) = map(int, input().split())
if k > (n + 1) // 2:
	number = 2 * (k - (n + 1) // 2)
else:
	number = 2 * k - 1
print(number)


import math
(n, k) = list(map(int, input().split()))
p = int(math.ceil(n / 2))
if k <= p:
	print(2 * k - 1)
else:
	print((k - p) * 2)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
c = k - (n + 1) // 2
if c > 0:
	print(2 * c)
else:
	print(2 * k - 1)


def countOdd(R, L=0):
	N = (R - L) // 2
	if R % 2 != 0 or L % 2 != 0:
		N += 1
	return N

def even(L, R):
	od = countOdd(R, L)
	N = R - L + 1 - od
	return N
(a, b) = map(int, input().split())
odd = countOdd(a, 1)
even = even(0, a)
if odd >= b:
	print(2 * b - 1)
elif odd < b:
	z = b - odd
	print(2 * z)


from math import ceil
g = input().split()
a = int(g[0])
b = int(g[1])
if ceil(a / 2) >= b:
	print(b * 2 - 1)
else:
	print((b - ceil(a / 2)) * 2)


a = [int(i) for i in input().split()]
n = a[0]
k = a[1]
odds = n - int(n / 2)
if k <= odds:
	print(2 * k - 1)
else:
	k = k - odds
	print(2 * k)


(n, k) = map(int, input().split())
s = (n + 1) // 2
print(2 * k - [1, 2 * s][k > s])


def seperateints(x):
	k = ''
	l = []
	for i in x:
		if i == ' ':
			l.append(int(k))
			k = ''
			continue
		k = k + i
	l.append(int(k))
	return l

def luckynum(x):
	for i in x:
		if i != '4' and i != '7':
			return False
	return True
l = seperateints(input())
if l[0] % 2 == 0:
	o = l[0] // 2
	if l[1] > o:
		print(2 * (l[1] - o))
	else:
		print(2 * l[1] - 1)
else:
	o = l[0] // 2 + 1
	if l[1] > o:
		print(2 * (l[1] - o))
	else:
		print(2 * l[1] - 1)


(n, k) = map(int, input().split())
number_of_even = n // 2
number_of_odd = n - number_of_even
if k > number_of_odd:
	k = k - number_of_odd
	print(2 * k)
else:
	print(2 * k - 1)


import math
a = list(map(int, input().split()))
n = a[0]
k = a[1]
m = math.ceil(n / 2)
if k <= m:
	to_p = 2 * (k - 1) + 1
if k > m:
	to_p = 2 * (k - m)
print(to_p)


import math as mt
import sys as sy

class abc:

	def mkl(self):
		(n, k) = map(int, input().split())
		if k <= (n + 1) / 2:
			print(2 * k - 1)
		else:
			print(2 * (k - (n + 1) // 2))
b = abc()
b.mkl()


from math import *
(n, k) = [int(x) for x in input().split()]
if k <= floor((n + 1) / 2):
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - floor((n + 1) / 2)))


from sys import stdin, stdout
import math, queue, heapq
fastinput = stdin.readline
fastout = stdout.write
t = 1
while t:
	t -= 1
	(n, m) = map(int, fastinput().split())
	y = (n + 1) // 2
	if m <= y:
		print(2 * m - 1)
	else:
		print(2 * (m - y))


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
(n, k) = [int(x) for x in inp().split()]
if k <= math.ceil(n / 2):
	print(2 * k - 1)
else:
	t = k - math.ceil(n / 2)
	print(int(t * 2))


(n, k) = list(map(int, input().rstrip().split()))
odd = 2 * k - 1
if odd <= n:
	print(odd)
else:
	m = (n + 1) // 2
	ev = (k - m) * 2
	print(ev)


z = list(map(int, input().split()))
b = 0
if z[0] % 2 != 0:
	b = z[0] // 2 + 1
else:
	b = z[0] // 2
if z[1] > b:
	print((z[1] - b) * 2)
elif z[1] <= b:
	print(z[1] + z[1] - 1)


import math
s = input().split(' ')
(n, k) = (int(s[0]), int(s[1]))
if k <= math.ceil(n / 2):
	print(k * 2 - 1)
else:
	print(math.floor(k - n / 2) * 2)


def resolve(n, k):
	if n % 2 == 0:
		quant_par = n // 2
		quant_impar = n // 2
	else:
		quant_par = (n - 1) // 2
		quant_impar = n - quant_par
	if k <= quant_impar:
		return 2 * k - 1
	else:
		return 2 * (k - quant_impar)
(n, k) = [int(a) for a in input().split(' ')]
print(resolve(n, k))


(n, k) = map(int, input().split(' '))
nOdd = 0
nEven = 0
if n % 2 == 0:
	nOdd = n // 2
	nEven = n // 2
else:
	nOdd = n // 2 + 1
	nEven = nOdd - 1
ans = 0
if k <= nOdd:
	ans = 1 + (k - 1) * 2
else:
	k -= nOdd
	ans = 2 + (k - 1) * 2
print(ans)


(n, k) = map(int, input().strip().split())
if n / 2 < k and n % 2 == 0:
	s = int((k - n / 2) * 2)
elif n / 2 + 1 >= k:
	s = k * 2 - 1
elif n / 2 < k:
	s = int((k - (n / 2 + 1)) * 2)
	if s % 2 == 1:
		s += 1
print(s)


from math import *

def main():
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		o = n // 2
		e = n // 2
	else:
		o = (n + 1) // 2
		e = (n - 1) // 2
	if k <= o:
		print(2 * k - 1)
	else:
		print(2 * (k - o))
main()


import math
(n, k) = map(int, input().split())
odd_lim = math.ceil(n / 2)
even_start = odd_lim + 1
if k <= odd_lim:
	print(2 * k - 1)
else:
	even_start = k - even_start + 1
	print(2 * even_start)


import math
(n, k) = map(int, input().split())
parnych = math.trunc(n / 2)
neparnych = math.ceil(n / 2)
if k <= neparnych:
	print(k * 2 - 1)
else:
	print((k - neparnych) * 2)


read = input().split()
n = int(read[0])
d = int(read[1])
if d > (n + 1) // 2:
	print((d - (n + 1) // 2) * 2)
else:
	print(2 * d - 1)


input = input()
numeros = input.split(' ')
natural = int(numeros[0])
posicion = int(numeros[1])
if natural % 2 == 0:
	largopar = natural / 2
	largoinpar = natural / 2
else:
	largopar = natural // 2
	largoinpar = largopar + 1
if posicion <= largoinpar:
	print(int(2 * posicion - 1))
else:
	print(int(2 * (posicion - largoinpar)))


nk = list(map(int, input().rstrip().split()))
n = nk[0]
k = nk[1]
if n % 2 == 0:
	if k <= n // 2:
		print(k * k - (k - 1) * (k - 1))
	else:
		number = k - n // 2
		print(number * (number + 1) - number * (number - 1))
elif k <= (n + 1) // 2:
	print(k * k - (k - 1) * (k - 1))
else:
	number = k - (n + 1) // 2
	print(number * (number + 1) - number * (number - 1))


import sys

def data():
	return sys.stdin.readline().strip()

def sp():
	return map(int, data().split())

def l():
	return list(sp())
temp = l()
n = temp[0]
k = temp[1]
if k <= (n + 1) / 2:
	res = k * 2 - 1
	print(int(res))
else:
	res = (k - (n + 1) // 2) * 2
	print(int(res))


(n, k) = input().split()
n = int(n)
k = int(k)
nl = (n + 1) // 2
if k <= nl:
	rs = 2 * k - 1
else:
	rs = (k - nl) * 2
print(rs)


a = [int(n) for n in input().split()]
if a[0] % 2 == 0:
	yu = int(a[0] / 2)
else:
	yu = int(a[0] / 2) + 1
if a[1] < yu:
	print(2 * a[1] - 1)
elif a[1] == yu:
	print(2 * a[1] - 1)
else:
	if a[0] % 2 == 0:
		k = a[0] / 2
	else:
		k = int(a[0] / 2) + 1
	v = a[1] - k
	print(int(2 * v))


(range, pos) = map(int, input().split())
var = 0
if range % 2 == 0:
	var = int(range / 2)
else:
	var = int(range / 2) + 1
if pos <= var:
	print(pos * 2 - 1)
else:
	print(2 * (pos - var))


l = [int(i) for i in input().split()]
n = l[0]
pos = l[1]
if n % 2 == 0:
	if pos <= n / 2:
		print(int(pos * 2 - 1))
	else:
		print(int(pos - n / 2) * 2)
elif pos <= n / 2 + 1:
	print(int(pos * 2 - 1))
else:
	print(int(pos - int(n / 2) - 1) * 2)


from math import ceil
(n, m) = map(int, input().split())
mid = ceil(n / 2)
if m <= mid:
	res = 2 * m - 1
else:
	m1 = m - mid
	res = 2 * m1
print(res)


import sys
import math
(n, k) = input().split()
n = int(n)
k = int(k)
if k <= math.ceil(n / 2):
	print(k * 2 - 1)
else:
	ans = k - math.ceil(n / 2)
	print(2 * ans)


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
(n, number) = map(int, f_input().split())
if n % 2 == 0:
	if number > n // 2:
		f_print(str((number - n // 2) * 2))
	else:
		f_print(str(number * 2 - 1))
elif number > n // 2 + 1:
	f_print(str((number - n // 2 - 1) * 2))
else:
	f_print(str(number * 2 - 1))


(m, k) = map(int, input().split())
if m % 2 is 0:
	if k > m / 2:
		print(int((k - m / 2) * 2))
	else:
		print(int(k * 2 - 1))
elif k > m // 2 + 1:
	print(int((k - (m // 2 + 1)) * 2))
else:
	print(int(k * 2 - 1))


inp = input()
(n, k) = inp.split()
n = int(n)
k = int(k)
if n // 2 == n / 2:
	if k <= n / 2:
		total = 2 * k - 1
	else:
		total = 2 * (k - n // 2)
elif k <= (n + 1) / 2:
	total = 2 * k - 1
else:
	total = 2 * (k - (n + 1) // 2)
print(total)


(n, m) = map(int, input().split())
last = (n + 1) // 2
if m <= last:
	print(2 * m - 1)
else:
	m -= last
	print(2 * m)


(n, k) = map(int, input().split())
nodd = (n + 1) // 2
if k - 1 >= nodd:
	k -= nodd
	print(2 * k)
else:
	print(1 + 2 * (k - 1))


import sys
import os
if os.environ.get('DEBUGSTER_PYTHON'):
	sys.stdin = open('in.txt', 'r')
	sys.stdout = open('out.txt', 'w')
(n, k) = map(int, input().split())
if n % 2 == 0:
	h = n // 2
else:
	h = n // 2 + 1
if k <= h:
	ans = 2 * k - 1
else:
	ans = (k - h) * 2
print(ans)


(z, x) = [int(c) for c in input().split()]
if 1 <= x and x <= z <= 10 ** 12:
	if z % 2 == 0:
		if x <= z / 2:
			print(2 * x - 1)
		else:
			print(2 * x - z)
	elif x <= z // 2 + 1:
		print(2 * x - 1)
	else:
		print(2 * x - z - 1)


(n, k) = map(int, input().split())
ans = 1
if n % 2 != 0:
	n2 = int(n / 2) + 1
	if k <= n2:
		ans = 2 * k
		ans -= 1
	elif k > n2:
		k = k - n2
		ans = 2 * k
elif n % 2 == 0:
	n2 = int(n / 2)
	if k <= n2:
		ans = 2 * k
		ans -= 1
	elif k > n2:
		k = k - n2
		ans = 2 * k
print(ans)


(n, k) = map(int, input().split())
array = []
if k <= (n + 1) // 2:
	print(2 * k - 1)
else:
	print(2 * (k - (n + 1) // 2))


from sys import stdin, stdout
(n, p) = map(int, stdin.readline().split())
if n % 2 == 0:
	if p > n / 2:
		print(int(2 + (p - n / 2 - 1) * 2))
	else:
		print(int(1 + (p - 1) * 2))
elif p > n // 2 + 1:
	print(int(2 + (p - (n // 2 + 2)) * 2))
else:
	print(int(1 + (p - 1) * 2))


a = input().split()
d = int(a[0])
g = int(a[1])
if d % 2 != 0:
	k = d // 2 + 1
else:
	k = d / 2
if g > k:
	t = (g - k) * 2
else:
	t = 2 * g - 1
print(int(t))


import math
(n, k) = [int(t) for t in input().split()]
if n % 2 != 0:
	if n + 1 >= 2 * k:
		print(2 * k - 1)
	else:
		print(2 * (k - math.ceil(n / 2)))
elif n >= 2 * k:
	print(2 * k - 1)
else:
	print(2 * (k - math.ceil(n / 2)))


(n, k) = map(int, input().split())
if abs(-n // 2) >= k:
	print(k * 2 - 1)
else:
	k = k - abs(-n // 2)
	print(2 * k)


(N, I) = map(int, input().split())
if N % 2 == 0:
	print(I - 1 + I if I <= N // 2 else I - (N - I))
else:
	print(I + (I - 1) if I <= N // 2 + 1 else I - (N - I) - 1)


l = list(map(int, input().split()))
m = l[0]
n = l[1]
if m == n and n % 2 == 0:
	print(n)
else:
	if m % 2 == 0:
		x = m // 2
	else:
		x = m // 2 + 1
	if n > x:
		print(n % x * 2)
	else:
		print(n * 2 - 1)


import math
st = ''

def func(n, k):
	if n & 1:
		sep = (n + 1) // 2
	else:
		sep = n // 2
	if k <= sep:
		return 2 * k - 1
	return 2 * (k - sep)
for _ in range(1):
	(n, k) = map(int, input().split())
	st += str(func(n, k)) + '\n'
print(st)


(n, k) = map(int, input().split())
d = n // 2
if not n % 2:
	if k <= d:
		k -= 1
		num = 1 + k * 2
	else:
		k -= 1
		num = 2 + (k - d) * 2
else:
	d += 1
	if k <= d:
		k -= 1
		num = 1 + k * 2
	else:
		k -= 1
		num = 2 + (k - d) * 2
print(num)


import math

def wtf(n, k):
	if n % 2 == 0:
		if k <= int(n / 2):
			return 2 * k - 1
		else:
			l = k - int(n / 2)
			return 2 * l
	elif n % 2 != 0:
		l = math.ceil(n / 2)
		if k <= l:
			return 2 * k - 1
		else:
			a = k - l
			return 2 * a
(n, k) = map(int, input().split())
print(wtf(n, k))


(n, i) = map(int, input().split())
qtd_impar = 0
qtd_par = 0
if n % 2 == 0:
	qtd_impar = int(n / 2)
	qtd_par = int(n / 2)
else:
	qtd_impar = int(n / 2) + 1
	qtd_par = int(n / 2)
if i <= qtd_impar:
	num = 1 + (i - 1) * 2
	print(num)
else:
	i -= qtd_impar
	num = 0 + 2 * i
	print(num)


def main():
	(n, k) = map(int, input().split())
	if n % 2 == 0:
		bound = n // 2
	elif n % 2 != 0:
		bound = (n + 1) // 2
	if k <= bound:
		ans = 2 * k - 1
		print(ans)
	elif k > bound:
		ans = (k - bound) * 2
		print(ans)
main()


def s(n, k):
	if n % 2 == 0:
		h = n // 2
	else:
		h = n // 2 + 1
	if k <= h:
		return 2 * k - 1
	else:
		return 2 * (k - h)
(n, k) = map(int, input().split())
print(s(n, k))


import math
nk = input().split()
(n, k) = (int(nk[0]), int(nk[1]))
if k == 1:
	print(1)
elif k <= math.ceil(n / 2):
	print(k * 2 - 1)
elif k > math.floor(n / 2):
	print((k - math.ceil(n / 2)) * 2)
else:
	pass


from math import ceil
(n, k) = [int(__) for __ in input().strip().split()]
if k > ceil(n / 2):
	print(2 * (k - ceil(n / 2)))
else:
	print(2 * k - 1)


prog_input = input()
(n, k) = prog_input.split(' ')
n = int(n)
k = int(k)
if n % 2 == 0:
	odd_length = n // 2
else:
	odd_length = n // 2 + 1
if k <= odd_length:
	print(2 * k - 1)
else:
	k -= odd_length
	print(2 * k)


from math import ceil
(n, k) = [int(i) for i in input().split()]
h = ceil(n / 2)
if k <= h:
	print(2 * k - 1)
else:
	s = k - h
	print(2 * s)


(number, location) = [int(i) for i in input().split()]
if number % 2 == 0:
	num2Start = number // 2 + 1
else:
	num2Start = number // 2 + 2
if location >= num2Start:
	print(2 + (location - num2Start) * 2)
else:
	print(1 + (location - 1) * 2)


(n, k) = [int(i) for i in input().split()]
mid = n // 2 + n % 2
if k <= mid:
	X = 2 * k - 1
else:
	X = 2 * (k - mid)
print(X)


r = str(input())
arr = r.split()
n = int(arr[0])
index = int(arr[1])
half = n // 2
if n & 1 == 1:
	half = half + 1
if index <= half:
	diff = index - 1
	ans = 1 + diff * 2
	print(ans)
else:
	diff = index - 1 - half
	ans = 2 + diff * 2
	print(ans)


n = [int(i) for i in input().split(' ')]
a = n[0]
b = n[1]
if a % 2 == 0:
	if b <= a // 2:
		print(2 * b - 1)
	else:
		b = b - a // 2
		print(2 * b)
elif b <= a // 2 or b == (a + 1) // 2:
	print(2 * b - 1)
else:
	b = b - a // 2
	print(2 * b - 2)


inp = input()
spc = inp.find(' ')
n = int(inp[:spc])
k = int(inp[spc:])
if n % 2 != 0:
	if k > (n + 1) / 2:
		z = 2 * k - n - 1
	else:
		z = 2 * k - 1
elif k < n / 2 or k == n / 2:
	z = 2 * k - 1
elif k > n / 2:
	z = 2 * (k - n / 2)
print(int(z))


L = list(input().split())
(n, k) = (int(L[0]), int(L[1]))
if n % 2 == 0:
	if k <= int(n / 2):
		print(2 * k - 1)
	else:
		print(2 * (k - int(n / 2)))
elif k <= int((n + 1) / 2):
	print(2 * k - 1)
else:
	print(2 * (k - int((n + 1) / 2)))


import math
word = input()
list1 = []
(n, k) = word.split(' ')
n = int(n)
k = int(k)
if k <= (n + 1) / 2:
	print(k * 2 - 1)
else:
	print(int(math.ceil(k - (n + 1) / 2) * 2))


def find_index(n):
	if n % 2 == 0:
		return int(n / 2)
	else:
		return int((n + 1) / 2)

def answer(k, n):
	index = find_index(n)
	if k > index:
		print((k - index) * 2)
	else:
		print(k * 2 - 1)
(n, k) = input().split(' ')
n = int(n)
k = int(k)
answer(k, n)


(n, k) = map(int, input().split())
l = range(1, n + 1)
if n % 2 != 0:
	e = int(n // 2)
	o = int(n // 2) + 1
else:
	e = int(n // 2)
	o = int(n // 2)
if k > o:
	k = k - o
	print(k * 2)
else:
	print(2 * k - 1)


Numbers = input().split(' ')
n = int(Numbers[0])
k = int(Numbers[1])
numberOfOddNumbers = (n - 1) // 2 + 1
numberOfEvenNumbers = n // 2
if k <= numberOfOddNumbers:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - numberOfOddNumbers))


total = input().split()
total_int = int(total[0])
val_int = int(total[1])
if total_int % 2 == 0:
	len_odd_num = int(total_int / 2)
else:
	len_odd_num = int(total_int / 2) + 1
if len_odd_num >= val_int:
	print(1 + (val_int - 1) * 2)
else:
	sub_int = val_int - len_odd_num
	print(2 * sub_int)


(a, b) = map(int, input().split())
if b <= (a + 1) // 2:
	print(2 * b - 1)
elif b > a // 2:
	b = b - (a + 1) // 2
	print(2 * b)


temp = input().split()
n = int(temp[0])
index = int(temp[1])
if n % 2 == 0:
	if index <= n // 2:
		print(2 * index - 1)
	else:
		print(2 * (index - n // 2))
elif index <= (n + 1) // 2:
	print(2 * index - 1)
else:
	print(2 * (index - (n + 1) // 2))


(limit, hasil) = map(int, input().split())
kondisi = ''
if limit % 2 == 0:
	tengah = limit / 2
else:
	tengah = (limit + 1) / 2
if hasil > tengah:
	kondisi = 'genap'
else:
	kondisi = 'ganjil'
if kondisi == 'ganjil':
	print(int(1 + (hasil - 1) * 2))
else:
	print(int(2 + (hasil - tengah - 1) * 2))


(n, k) = input().split()
(n, k) = (int(n), int(k))
if n % 2 == 0:
	(oddcount, evencount) = (n // 2, n // 2)
else:
	oddcount = (n + 1) // 2
	evencount = oddcount - 1
if k <= oddcount:
	print(2 * k - 1)
else:
	print(2 * (k - oddcount))


import math
(n, m) = map(int, input().split())
half = math.ceil(n / 2)
print([2 * m - 1, (m - half) * 2][m > half])


(n, k) = map(int, input().split())
of = n // 2
if n % 2 == 1:
	of += 1
if k <= of:
	print(k * 2 - 1)
else:
	k -= of
	print(2 * k)


L = input()
L = L.split()
N = int(L[0])
P = int(L[1])
if N % 2 == 1:
	if P <= N // 2 + 1:
		print(P * 2 - 1)
	else:
		print(P * 2 - 1 - N)
elif P <= N // 2:
	print(P * 2 - 1)
else:
	print(P * 2 - N)


from sys import stdin

def ip():
	return [int(i) for i in stdin.readline().split()]

def sp():
	return [str(i) for i in stdin.readline().split()]

def pp(A):
	for i in A:
		print(i)

def solve():
	(n, k) = ip()
	if n % 2 == 0:
		h = int(n // 2)
		if k > h:
			return 2 * (k - h)
		else:
			return k * 2 - 1
	else:
		h = int(n // 2) + 1
		if k > h:
			return 2 * (k - h)
		else:
			return k * 2 - 1
print(solve())


(n, k) = [int(j) for j in input().split()]
ec = n / 2
oc = int((n + 1) / 2)
if k <= oc:
	an = 1 + (k - 1) * 2
	print(an)
else:
	an = 2 + (k - oc - 1) * 2
	print(an)


(n, k) = map(int, input().split())
if n % 2 == 0:
	q_n = n / 2
	q_c = n / 2
	if k <= q_n:
		print(2 * k - 1)
	else:
		print(2 * k - n)
else:
	q_n = n // 2 + 1
	q_c = n // 2
	if k <= q_n:
		print(2 * k - 1)
	else:
		print(2 * k - n - 1)


def even_odds():
	numbers = input().split()
	numbers = [int(i) for i in numbers]
	if numbers[1] == 1:
		print(1)
		return
	if numbers[0] % 2 == 0:
		if numbers[1] > numbers[0] / 2:
			numbers[1] = int(numbers[1] - numbers[0] / 2)
			print(2 + 2 * (numbers[1] - 1))
		else:
			print(1 + 2 * (numbers[1] - 1))
	elif numbers[1] > (numbers[0] + 1) / 2:
		numbers[1] = int(numbers[1] - (numbers[0] + 1) / 2)
		print(2 + 2 * (numbers[1] - 1))
	else:
		print(1 + 2 * (numbers[1] - 1))
even_odds()


def fun(n, k):
	val = 0
	if n % 2 == 0:
		val = n // 2
	else:
		val = n // 2 + 1
	if k <= val:
		print(2 * k - 1)
	else:
		print(2 * abs(val - k))
(n, k) = list(map(lambda x: int(x), input().split()))
fun(n, k)


(n, k) = map(int, input().split())
if n % 2 == 0:
	a = n // 2
else:
	a = n // 2 + 1
if k <= a:
	print(2 * k - 1)
else:
	diff = abs(k - a)
	print(2 * diff)


import math
(n, k) = list(map(int, input().split()))
ec = oc = 0
if n % 2 == 0:
	ec = int(n / 2)
else:
	ec = math.floor(n / 2)
oc = n - ec
if k <= oc:
	print(1 + (k - 1) * 2)
else:
	print(2 + (k - 1 - oc) * 2)


(n, k) = map(int, input().split())
count_odds = n - n // 2
if k > count_odds:
	print(2 * (k - count_odds))
else:
	print(2 * k - 1)


x = input().split()
x[1] = int(x[1])
x[0] = int(x[0])
if x[0] % 2 != 0:
	n2 = int(x[0] / 2) + 1
else:
	n2 = x[0] / 2
if x[0] % 2 == 0:
	if x[1] <= n2:
		print(x[1] + (x[1] - 1))
	else:
		print(x[1] - (x[0] - x[1]))
elif x[1] <= n2:
	print(x[1] + (x[1] - 1))
else:
	print(x[1] - (x[0] - x[1]) - 1)


x = input().split()
n = int(x[0])
k = int(x[1])
first_even_position = (n + 1) // 2 + 1
if k < first_even_position:
	number = k * 2 - 1
else:
	number = (k - first_even_position + 1) * 2
print(number)


(n, k) = input().split()
n = int(n)
k = int(k)
if k <= (n + 1) // 2:
	print(2 * k - 1)
else:
	p = k - (n + 1) // 2
	print(2 * p)


(n, k) = map(int, input().split())
if n % 2 == 0:
	ce = co = n // 2
else:
	ce = n // 2
	co = (n + 2) // 2
if k <= co:
	print(2 * k - 1)
else:
	print(2 * (k - co))


(n, k) = tuple(input().split())
n = int(n)
k = int(k)
if k == 1:
	print(1)
	exit(0)
if n == k and n % 2 == 1:
	print(n - 1)
	exit(0)
elif n == k:
	print(n)
	exit(0)
if n % 2 == 0 and k <= n // 2 or (n % 2 == 1 and k <= n // 2 + 1):
	print(2 * k - 1)
	exit(0)
elif n % 2 == 0:
	print((k - n // 2) * 2)
	exit(0)
else:
	print((k - (n // 2 + 1)) * 2)


import math
lt = list(map(int, input().split()))
x = lt[0]
y = lt[1]
print([2 * y - 1, 2 * (y - math.ceil(x / 2))][y > math.ceil(x / 2)])


(n, k) = map(int, input().split())
if n % 2 == 0:
	m = n // 2
else:
	m = n // 2 + 1
if k <= m:
	ans = 1 + 2 * (k - 1)
else:
	p = k - m
	ans = 2 + 2 * (p - 1)
print(ans)


from math import ceil
(n, k) = map(int, input().split())
(x, k, half) = (k // n, k % n, ceil(n / 2))
if k == 0:
	k = n
	x -= 1
if x % 2 != 0 and n % 2 != 0:
	half -= 1
print(x * n + 2 * (k - half) if k > half else x * n + 2 - (1 - x * n % 2) + 2 * (k - 1))


(n, k) = input().split()

def watch(n, k):
	x = n // 2
	x = x + 1 if n % 2 != 0 else x
	q = 1 if n % 2 == 0 else 0
	if x >= k:
		a = n - (q + (x - k) * 2)
		print(a)
	else:
		a = (k - x) * 2
		print(a)
watch(int(n), int(k))


(n, k) = map(int, input().split())
if n & 1:
	w = (n + 1) // 2
	if k <= w:
		print(2 * k - 1)
	else:
		k -= w
		print(2 * k)
else:
	w = n // 2
	if k <= w:
		print(2 * k - 1)
	else:
		k -= w
		print(2 * k)


(a, b) = input().split()
x = int(a)
y = int(b)
i = 1
even = []
odd = []
if y * 2 > x + 1:
	cutoff = abs(x / 2 - y)
	value = int(cutoff) * 2
else:
	value = y * 2 - 1
print(value)


(n, m) = map(int, input().split())
if n % 2 == 1:
	t = int(n / 2) + 1
else:
	t = int(n / 2)
if m <= t:
	print(2 * m - 1)
else:
	t = m - t
	print(2 * t)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007
(n, k) = In()
if n % 2 == 0:
	if k <= n // 2:
		print(2 * (k - 1) + 1)
	else:
		print(2 * (k - n // 2))
elif k <= n // 2 + 1:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - (n // 2 + 1)))


(n, k) = eval(input().replace(' ', ','))
t = (n + 1) // 2
print(2 * k - [1, 2 * t][k > t])


import math, random
(n, k) = list(map(int, input().split(' ')))

def naive(n, k):
	nums = []
	odd = 1
	while odd <= n:
		nums.append(odd)
		odd += 2
	even = 2
	while even <= n:
		nums.append(even)
		even += 2
	return nums[k - 1]

def solve(n, k):
	if k > math.ceil(n / 2):
		k -= math.ceil(n / 2)
		return k * 2
	else:
		return k * 2 - 1
print(solve(n, k))

def tests():
	while True:
		n = random.randint(5, 100)
		k = random.randint(1, n)
		my = solve(n, k)
		nai = naive(n, k)
		print('n', n, 'k', k)
		print(my, nai)
		assert my == nai


(n, k) = input().split()
(n, k) = (int(n), int(k))
odd = 0
even = 0
if n % 2 == 0:
	odd = n // 2
	even = n // 2
else:
	odd = n // 2 + 1
	even = n - odd
if k <= odd:
	print(2 * k - 1)
else:
	temp = k - odd
	print(2 * temp)


import math

def evenOdds(k, n):
	temp = math.ceil(n / 2) if n & 1 else n / 2
	return 2 * k - 1 if k <= temp else 2 * (k - temp)
(n, k) = map(int, input().split())
print(int(evenOdds(k, n)))


from sys import stdin, stdout

def num(a, n, d):
	return a + (n - 1) * d
(n, k) = map(int, input().split())
if n % 2 == 0:
	part = int(n / 2)
else:
	part = int(n / 2) + 1
if k > part:
	print(num(2, k - part, 2))
else:
	print(num(1, k, 2))


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def ist(x):
	d = 1
	while d < x:
		d *= 2
	return d == x
(n, m) = map(int, input().split())
if m <= n // 2 + n % 2:
	print(m * 2 - 1)
else:
	print((m - (n // 2 + n % 2)) * 2)


masuk = input().split()
a = int(masuk[0])
b = int(masuk[1])
if a % 2 == 0:
	if b > a / 2:
		hasil = (b - a / 2) * 2
	else:
		hasil = (b - 1) * 2 + 1
elif b > int(a / 2) and b - (int(a / 2) + 1) != 0:
	hasil = (b - (int(a / 2) + 1)) * 2
else:
	hasil = (b - 1) * 2 + 1
print(int(hasil))


import math
(i, k) = map(int, input().split())
if i % 2 == 0:
	even = i // 2
	odd = i // 2
else:
	odd = math.ceil(i / 2)
	even = i - odd
if k <= odd:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - odd - 1) + 2)


import math
(n, k) = map(int, input().split())
if k == n and (not n % 2):
	print(n)
else:
	print(2 * k - 1 if k <= math.ceil(n / 2) else k % math.ceil(n / 2) * 2)


(n, m) = input().split()
n = int(n)
m = int(m)

def odd(x):
	if x % 2 != 0:
		return True
	else:
		return False

def even(x):
	if x % 2 == 0:
		return True
	else:
		return False
if odd(n):
	p = n // 2 + 1
if even(n):
	p = n // 2
if m == p:
	print(1 + (m - 1) * 2)
if even(n):
	if m - p > 0:
		if m == p + 1:
			print(2)
		if m != p + 1:
			print((m - n // 2) * 2)
	if m - p < 0:
		print(1 + (m - 1) * 2)
if odd(n):
	if m - p > 0:
		if m == p + 1:
			print(2)
		if m != p + 1:
			print((m - n // 2 - 1) * 2)
	if m - p < 0:
		print(1 + (m - 1) * 2)


(n, k) = [int(x) for x in input().split()]
if n % 2 == 0:
	k1 = n // 2
	if k > k1:
		print(2 * (k - k1))
	if k <= k1:
		print(2 * k - 1)
if n % 2 == 1:
	k1 = (n + 1) // 2
	if k > k1:
		print(2 * (k - k1))
	if k <= k1:
		print(2 * k - 1)


def main(n, k):
	odd = n // 2 + n % 2
	even = n // 2
	if k <= odd:
		print(1 + (k - 1) * 2)
		return
	else:
		loc = k - odd
		print(2 + (loc - 1) * 2)
		return
(n, k) = list(map(int, input().split(' ')))
main(n, k)


arr = list(map(int, input().split()))
n = arr[0]
i = arr[1]
if n % 2 == 0:
	if i > n / 2:
		print(int((i - n / 2) * 2))
	else:
		print(i * 2 - 1)
elif i > n / 2 + 1:
	print((i - (int(n / 2) + 1)) * 2)
else:
	print(i * 2 - 1)


(n, x) = input().split()
x = int(x)
n = int(n)
if n % 2 != 0:
	total_odd = (n + 1) / 2
else:
	total_odd = n / 2
if x <= total_odd:
	print(int(2 * x - 1))
else:
	print(int(2 * (x - total_odd)))


tc = list(map(int, input().split()))
n = tc[0]
k = tc[1]
if n % 2 == 0:
	if k <= n // 2:
		res = 2 * k - 1
		print(int(res))
	else:
		t = n // 2
		res = 2 + (k - t - 1) * 2
		print(int(res))
elif k <= (n + 1) // 2:
	res = 2 * k - 1
	print(int(res))
else:
	t = (n + 1) // 2
	res = 2 + (k - t - 1) * 2
	print(int(res))


import math

def evenodd(n, m):
	if m <= math.ceil(n / 2):
		a = 2 * m - 1
	else:
		f = m - math.ceil(n / 2)
		a = 2 * f
	return a
(n, m) = map(int, input().split())
z = evenodd(n, m)
print(z)


(n, k) = input().split()
n = int(n)
k = int(k)
r = n % 2
if r == 1:
	n1 = int(n / 2) + 1
	if k <= n1:
		num = k * 2 - 1
	else:
		k1 = k - n1
		num = k1 * 2
else:
	n1 = int(n / 2)
	if k <= n1:
		num = k * 2 - 1
	else:
		k1 = k - n1
		num = k1 * 2
print(int(num))


import math
(num1, num2) = input().split(' ')
num1 = int(num1)
num2 = int(num2)
mid = num1 / 2
mid = math.ceil(mid)
if num2 > mid:
	res = num2 - mid
	res = res * 2
else:
	res = num2 - 1
	res = res + num2
print(res)


l = input()
A = l.split(' ')
n = int(A[0])
k = int(A[1])
del A, l
if n % 2 == 1:
	if k > n // 2 + 1:
		print(2 * (k - n // 2 - 1))
	else:
		print(2 * k - 1)
elif k > n // 2:
	print(2 * (k - n // 2))
else:
	print(2 * k - 1)


from bisect import bisect_right as br
import sys
from collections import *
from math import *
import re

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	c = 0
	for i in range(2, n):
		if prime[i]:
			c += 1
	return c

def iseven(n):
	return [False, True][0 if n % 2 else 1]

def inp_arr():
	return list(map(int, input().split()))

def inp():
	return map(int, input().split())

def lcm(a, b):
	return a * b / gcd(a, b)
max_int = sys.maxsize
mod = 10 ** 9 + 7
(n, x) = inp()
t = x - (n + 1) // 2
print([2 * x - 1, 2 * t][t > 0])


temp = list(map(int, input().split()))
n = temp[0]
k = temp[1]
even = n // 2
odd = n - even
if k <= odd:
	ans = 2 * (k - 1) + 1
else:
	k = k - odd
	ans = 2 * k
print(ans)


t = list(map(int, input().split()))
list = []
even = t[0] // 2
odd = t[0] - even
if t[1] <= odd:
	k = 1 + (t[1] - 1) * 2
	print(k)
else:
	m = t[1] - odd
	k = 2 + (m - 1) * 2
	print(k)


__author__ = 'Utena'
(m, n) = map(int, input().split())
if m % 2 == 1:
	if n <= (m + 1) // 2:
		print(2 * n - 1)
	else:
		print(2 * n - (m + 1))
elif n <= m // 2:
	print(2 * n - 1)
else:
	print(2 * n - m)


from sys import stdin
(n_str, k_str) = stdin.readline().strip().split(' ')
(n, k) = (int(n_str), int(k_str))
if n % 2 == 0:
	max_idx_odd = n // 2
else:
	max_idx_odd = (n + 1) // 2
if k <= max_idx_odd:
	kth_num = 2 * k - 1
else:
	kth_num = 2 * (k - max_idx_odd)
print(kth_num)


(n, k) = map(int, input().strip().split())
odd = int(n / 2 + 1)
even = int(n / 2)
if n % 2 == 0:
	if k > even:
		result = 2 + 2 * (k - 1 - even)
	elif k <= even:
		result = 1 + 2 * (k - 1)
elif k > odd:
	result = 2 + 2 * (k - 1 - odd)
elif k <= odd:
	result = 1 + 2 * (k - 1)
print(int(result))


(n, k) = map(int, input().split())
if k >= 1 and k <= n and (n <= 1000000000000):
	(odds, evens) = ((n + 1) // 2, n // 2)
	if k <= odds:
		print(int(k * 2) - 1)
	else:
		print(int((k - odds) * 2))


import math
(n, i) = input().split()
(n, i) = (int(n), int(i))
if i <= math.ceil(n / 2):
	print(1 + 2 * (i - 1))
else:
	i -= math.ceil(n / 2)
	print(i * 2)


import math
(n, k) = [int(s) for s in input().split(' ')]
odds = math.ceil(n / 2)
if k <= odds:
	print(2 * k - 1)
else:
	print(2 * (k - odds))


(n, k) = map(int, input().split())
evenStart = 0
if n % 2 == 0:
	evenStart = n / 2 + 1
else:
	evenStart = (n + 3) / 2
if k < evenStart:
	print(int(k * 2 - 1))
else:
	print(int((k + 1 - evenStart) * 2))


import math
(n, k) = map(int, input().split(' '))
p = math.ceil(n / 2)
if n & 1:
	if k > p:
		d = k - p
		print(2 + (d - 1) * 2)
	else:
		print(1 + (k - 1) * 2)
elif k > p:
	d = k - p
	print(2 + (d - 1) * 2)
else:
	print(1 + (k - 1) * 2)


def solve():
	r = input().split(' ')
	(n, k) = (int(r[0]), int(r[1]))
	if n % 2 == 1 and k * 2 == n + 1:
		print(n)
	elif k <= n // 2:
		print(k * 2 - 1)
	else:
		print((k - n // 2 - n % 2) * 2)
solve()


import math
import os
import random
import re
import sys
a = list(map(int, input().rstrip().split()))
n = int(a[0])
k = int(a[1])
(n1, p) = (0, 0)
(i, j) = (1, 2)
if n % 2 == 0:
	n1 = n // 2
else:
	n1 = n // 2 + 1
if k <= n1:
	p = i + (k - 1) * 2
else:
	t = k - n1
	p = j + (t - 1) * 2
print(p)


TN = 1

def solution():
	(n, k) = map(int, input().split())
	if k > (n + 1) // 2:
		print((k - (n + 1) // 2) * 2)
	else:
		print(2 * k - 1)
while TN != 0:
	solution()
	TN -= 1


(n, k) = map(int, input().split())
countch = n // 2
countnech = n - countch
if k <= countnech:
	print(2 * k - 1)
else:
	k = k - countnech
	print(2 * k)


def main():
	(n, k) = [int(x) for x in input().split()]
	mid = n // 2 + n % 2
	if k <= mid:
		no = 2 * k - 1
	elif k > mid:
		no = 2 * k - n - n % 2
	print(no)
main()


(n, i) = map(int, input().split())
if i * 2 <= n + 1:
	print(i * 2 - 1)
else:
	print(2 * (i - (n + 1) // 2))


def printO(n):
	print(1 + 2 * (n - 1))

def printE(n):
	print(2 + 2 * (n - 1))

def fun(n, k):
	if n % 2 == 0:
		if k > n // 2:
			printE(k - n // 2)
		else:
			printO(k)
	elif k > n // 2 + 1:
		printE(k - (n // 2 + 1))
	else:
		printO(k)
num = [int(i) for i in input().split()]
fun(num[0], num[1])


from sys import stdin, stdout
from math import ceil
(a, b) = [int(a) for a in stdin.read().split()]
if b <= ceil(a / 2):
	stdout.write(str(2 * b - 1))
else:
	stdout.write(str(2 * (b - ceil(a / 2))))


def calculate(n, k):
	half = (n + 1) // 2
	if k <= half:
		return int(2 * k - 1)
	else:
		return int(2 * (k - half))
(n, k) = map(int, input().split(' '))
print(calculate(n, k))


(t, k) = [int(i) for i in input().split()]
if k <= (t + 1) // 2:
	print(2 * k - 1)
else:
	k -= (t + 1) // 2
	print(2 * k)


def main():
	(n, k) = map(int, input().split())
	k -= 1
	if n & 1:
		mid = n // 2
		if k <= mid:
			ans = 2 * k + 1
		else:
			k -= mid + 1
			ans = 2 * k + 2
	else:
		mid = n // 2
		if k < mid:
			ans = 2 * k + 1
		else:
			k -= mid
			ans = 2 * k + 2
	print(ans)
	pass
main()


from sys import stdin, exit
(n, k) = map(int, stdin.readline().rstrip().split(' '))
odd_n = 1 + (k - 1) * 2
if odd_n > n:
	nums_in_odd = 0
	if n % 2 == 0:
		nums_in_odd = n // 2
	else:
		nums_in_odd = n // 2 + 1
	print(2 + (k - nums_in_odd - 1) * 2)
else:
	print(odd_n)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n, k) = I()
if k <= n // 2 + n % 2:
	print(2 * k - 1)
else:
	k -= n // 2 + n % 2
	print(2 * k)


even = []
odd = []
(n, k) = map(int, input().split())
if n % 2 == 0:
	mid = int(n / 2)
else:
	mid = int((n + 1) / 2)
if k > mid:
	answer = 2 + (k - mid - 1) * 2
else:
	answer = 1 + (k - 1) * 2
print(answer)


(n, k) = input().split()
if int(n) % 2 == 0:
	num = int(n) // 2
	if int(k) <= num:
		dist = 2 * (int(k) - 1)
		print(1 + dist)
	else:
		k = int(k) - num
		dist = 2 * (k - 1)
		print(2 + dist)
else:
	num = int(n) // 2
	if int(k) <= num + 1:
		dist = 2 * (int(k) - 1)
		print(1 + dist)
	else:
		k = int(k) - (num + 1)
		dist = 2 * (k - 1)
		print(2 + dist)


(n_val, k_val) = list(map(int, input().split()))
n_val_half = (n_val + 1) // 2
if k_val <= n_val_half:
	print(2 * k_val - 1)
else:
	print(2 * (k_val - n_val_half))


from math import *
(n, k) = map(int, input().strip(' ').split())
h = ceil(n / 2)
if k <= h:
	ans = k * 2 - 1
else:
	tmp = k - h
	ans = tmp * 2
print(ans)


import math
(a, b) = map(int, input().split(' '))
a1 = a
if b > a / 2:
	a = math.ceil(a / 2)
	b = b - a
	if b == 0 and a1 % 2 == 1:
		print(a1)
		exit()
	if a % 2 == 0:
		print(2 * b)
	else:
		print(2 * b)
else:
	print(2 * b - 1)


import math
(n, k) = list(map(int, input().strip().split()))
output = k * 2 - 1 if k <= math.ceil(n / 2) else (k - math.ceil(n / 2)) * 2
print(output)


import math
t = input()
temp = t.split()
n = int(temp[0])
k = int(temp[1])
oddLimit = math.ceil(n / 2)
if k <= oddLimit:
	print(k * 2 - 1)
if k > oddLimit:
	pos = k - oddLimit
	print(pos * 2)


(num, pos) = input().split()
num = int(num)
pos = int(pos)
nu = int(num)
if num % 2 == 0:
	if pos > num // 2:
		n = 2 * (pos - num // 2)
	else:
		n = num // 2 - pos
		n = nu - 2 * n - 1
	print(n)
elif pos == 1:
	print('1')
elif num == pos:
	print(pos - 1)
elif pos == (num - 1) // 2 + 1:
	print(num)
elif pos < (num - 1) // 2 + 1:
	print(2 * pos - 1)
else:
	print(2 * pos - num - 1)


(a, b) = map(int, input().split())
if a % 2 == 0:
	totalOdd = a // 2
	totalEven = a // 2
else:
	totalEven = a // 2
	totalOdd = a // 2
	totalOdd += 1
if b > totalOdd:
	ans = 2 * (b - totalOdd)
else:
	ans = 2 * b
	ans -= 1
print(ans)


inp1 = input().split(' ')
ans = 0
inp = int(inp1[1])
mx = (int(inp1[0]) + 1) // 2
if inp <= mx:
	ans = inp * 2 - 1
else:
	inp = inp - mx
	ans = inp * 2
print(ans)


from math import floor
(n, k) = map(int, input().split())
evenCount = floor(n / 2)
oddCount = n - evenCount
if k <= oddCount:
	print(2 * k - 1)
else:
	k -= oddCount
	print(2 * k)


(a, b) = input().split()
a = int(a)
b = int(b)
c = a // 2
if float(c) == a / 2:
	if b <= c:
		print(2 * b - 1)
	else:
		b -= c
		print(2 * b)
else:
	c += 1
	if b <= c:
		print(2 * b - 1)
	else:
		b -= c
		print(2 * b)


(n, k) = map(int, input().split())
l = []
if n % 2 == 0:
	n1 = int(n / 2)
else:
	n1 = int(n / 2) + 1
if k <= n1:
	print(k + k - 1)
else:
	print((k - n1) * 2)


(n, m) = map(int, input().split())
if n % 2 != 0:
	if m <= n // 2 + 1:
		ans = 2 * m - 1
		print(ans)
	elif m > n // 2 + 1:
		d = m - (n // 2 + 1)
		ans = 2 * d
		print(ans)
elif n % 2 == 0:
	if m <= n // 2:
		ans = 2 * m - 1
		print(ans)
	elif m > n // 2:
		d = m - n // 2
		ans = 2 * d
		print(ans)


d = [int(a) for a in input().split()]
n = d[0]
k = d[1]
if n % 2 == 0:
	l = n // 2
else:
	l = n // 2 + 1
if l - k >= 0:
	print(2 * k - 1)
else:
	print((k - l) * 2)


import functools
import logging
import os
import sys
import time
from typing import List
logger = logging.getLogger()
reader = sys.stdin
is_judge = os.getenv('DEBUGGING') is None

def timeit(func):

	@functools.wraps(func)
	def timed(*args, **kwargs):
		if is_judge:
			rv = func(*args, **kwargs)
		else:
			ts = time.time()
			rv = func(*args, **kwargs)
			te = time.time()
			logger.debug('performance %r %2.2fms', func.__name__, (te - ts) * 1000)
		return rv
	return timed

def read_ints():
	return [int(v) for v in reader.readline().strip().split(' ')]

def main():
	(n, k) = read_ints()
	if n % 2 == 0:
		if k <= n // 2:
			res = (k - 1) * 2 + 1
		else:
			res = (k - n // 2) * 2
	elif k <= n // 2 + 1:
		res = (k - 1) * 2 + 1
	else:
		res = (k - (n // 2 + 1)) * 2
	print(res)

def setup():
	global logger, reader
	if is_judge:
		logger.setLevel(logging.WARNING)
	else:
		handler = logging.StreamHandler(sys.stdout)
		handler.setLevel(logging.DEBUG)
		formatter = logging.Formatter('{asctime}s - {message}', style='{')
		handler.setFormatter(formatter)
		logger.addHandler(handler)
		logger.setLevel(logging.DEBUG)
		reader = open('input.txt')
setup()
try:
	main()
except KeyboardInterrupt:
	logger.debug('KeyboardInterrupt')
except IOError as e:
	logger.error(f'I/O error({e.errno}): {e.strerror}')


(n, k) = map(int, input().split())
numberOfOdds = (n + 1) // 2
if k <= numberOfOdds:
	print(2 * k - 1)
else:
	print(2 * (k - numberOfOdds))


from collections import Counter
a = list(input().split(' '))
(x, y) = (int(a[0]), int(a[1]))
if x % 2 == 0:
	if y <= x / 2:
		print(y + (y - 1))
	else:
		print((y - int(x / 2)) * 2)
elif y <= int(x / 2) + 1:
	print(y + (y - 1))
else:
	print((y - (int(x / 2) + 1)) * 2)


import math

def solve(n, k):
	if n & 1:
		odds = n // 2 + 1
	else:
		odds = n // 2
	if k > odds:
		return (k - odds) * 2
	else:
		return k * 2 - 1
(n, k) = list(map(int, input().split()))
result = solve(n, k)
print(result)


import math
from collections import defaultdict
from collections import Counter
import itertools

def solve(n, k):
	if n % 2 != 0:
		if k > math.ceil(n / 2):
			k = k - math.ceil(n / 2) - 1
			return 2 * k + 2
		elif k == math.ceil(n / 2):
			return n
		else:
			k = k - 1
			return 2 * k + 1
	elif k <= n // 2:
		k = k - 1
		return 2 * k + 1
	else:
		k = k - n // 2 - 1
		return 2 * k + 2
(n, k) = map(int, input().split(' '))
print(solve(n, k))


(n, k) = input().split()
n = int(n)
k = int(k)
no_of_odds = int((n + 1) / 2)
if k <= no_of_odds:
	print(2 * k - 1)
else:
	print(2 * (k - no_of_odds))


[n, k] = [int(a) for a in input().split(' ')]
if n % 2 == 0:
	partsize = n // 2
else:
	partsize = n // 2 + 1
if k <= partsize:
	ans = 1 + 2 * (k - 1)
else:
	k = k - partsize
	ans = 2 * k
print(ans)


n = input().split()
even = int(n[0]) // 2
odd = int(n[0]) - even
if int(n[1]) <= odd:
	res = int(n[1]) * 2 - 1
else:
	number = int(n[1]) - odd
	res = number * 2
print(res)


(n, k) = (int(x) for x in input().rsplit())
if n % 2 == 0:
	even = n // 2
	odd = n // 2
else:
	even = (n - 1) // 2
	odd = even + 1
if k > odd:
	k -= odd
	print(2 * k)
else:
	print(2 * k - 1)


import sys
from sys import stdin, stdout
import math
import random
import heapq
from collections import Counter
from functools import lru_cache
try:
	for _ in range(1):
		(n, k) = map(int, input().split())
		if n % 2 == 0:
			even = n // 2
			odd = n // 2
		else:
			even = n // 2
			odd = n - even
		if k <= odd:
			print(1 + (k - 1) * 2)
		else:
			k -= odd
			print(2 + (k - 1) * 2)
except EOFError as e:
	print(e)


(n, k) = map(int, input().split())
ne = n // 2
no = n - ne
if k <= no:
	print(2 * k - 1)
else:
	k = k - no
	print(2 * k)


import math
(n, p) = map(int, input().split())
print([p * 2 - (n + n % 2), p * 2 - 1][p <= math.ceil(n / 2)])


(n, k) = input().strip().split()
(n, k) = (int(n), int(k))
half = (n + n % 2) / 2
if k <= half:
	print(int((k - 1) * 2 + 1))
else:
	print(int((k - half) * 2))


import math
(n, k) = map(int, input().split())
c = int(math.ceil(n / 2))
if k <= c:
	print(k * 2 - 1)
elif k > c:
	print(2 * abs(c - k))


from math import *
(x, y) = input().split()
a = ceil(int(x) / 2)
b = int(y) - int(a)
if int(y) <= int(a):
	print(2 * int(y) - 1)
else:
	print(2 * int(b))


l = input()
l = l.split()
n = int(l[0])
k = int(l[1])
if n % 2 == 0:
	n_even = int(n / 2)
	n_odd = int(n / 2)
else:
	n_even = int(n / 2)
	n_odd = int(n / 2) + 1
if k > n_odd:
	new_k = k - n_odd
	result = 2 * new_k
else:
	result = k + (k - 1)
print(result)


(total, place) = map(int, input().split())
if total % 2 == 0:
	if place * 2 <= total:
		print(place * 2 - 1)
	else:
		print(place * 2 - total)
elif place * 2 < total or place * 2 - total - 1 == 0:
	print(place * 2 - 1)
else:
	print(place * 2 - total - 1)


(n, k) = list(map(int, input().split()))
num = int(n / 2) + 1 if n % 2 == 1 else int(n / 2)
if k > num:
	k_even = k - num
	print(k_even * 2)
else:
	k_odd = k
	print(k * 2 - 1)


(n, k) = [int(x) for x in input().split()]
if n % 2 == 0:
	odd = n // 2
else:
	odd = n // 2 + 1
if k > n:
	exit(0)
if k <= odd:
	print(int(2 * k - 1))
else:
	print(int((k - odd) * 2))


a = input()
a = a.split()
a1 = int(a[0])
a2 = int(a[1])
if a1 % 2 == 0:
	pares = a1 // 2
	if a2 <= pares:
		numero = 2 * a2 - 1
	else:
		a2 = a2 - pares
		numero = 2 * a2
else:
	pares = a1 // 2 + 1
	if a2 <= pares:
		numero = 2 * a2 - 1
	else:
		a2 = a2 - pares
		numero = 2 * a2
print(numero)


a = input()
l = a.split(' ')
for i in range(len(l)):
	l[i] = int(l[i])
if l[1] <= l[0] / 2 + (l[0] % 2 != 0) * 1:
	print(2 * l[1] - 1)
else:
	print(2 * l[1] - l[0] - (l[0] % 2 != 0) * 1)


inp = input().split()
for i in range(len(inp)):
	inp[i] = int(inp[i])
odd = int(inp[0] / 2 + 0.5)
if inp[1] > odd:
	print((inp[1] - odd) * 2)
else:
	print((inp[1] - 1) * 2 + 1)


inp = [int(i) for i in input().split()]
a = int(inp[0] / 2 + 0.5)
b = inp[1]
if b <= a:
	print(2 * inp[1] - 1)
else:
	print(2 * (inp[1] - a))


from math import ceil, floor
(a, b) = map(int, input().split())
c = ceil(a / 2)
d = floor(a / 2)
if b <= c:
	print(2 * b - 1)
else:
	print(2 * (b - c))


import math
(n, k) = [int(x) for x in input().split()]
if k <= math.ceil(n / 2) or n == 1:
	result = k * 2 - 1
else:
	if n % 2 == 0:
		diff = n // 2
	else:
		diff = n // 2 + 1
	result = (k - diff) * 2
print(result)


x = input()
x = x.split(' ')
odd = 0
even = 0
if int(x[0]) % 2 == 0:
	odd = int(x[0]) // 2
	even = int(x[0]) // 2
else:
	odd = int(x[0]) // 2 + 1
	even = int(x[0]) // 2
if odd >= int(x[1]):
	print(1 + (int(x[1]) - 1) * 2)
else:
	print(2 + (int(x[1]) - odd - 1) * 2)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, k) = LI()
	t = n // 2 + n % 2
	if k <= t:
		return k * 2 - 1
	k -= t
	return k * 2
print(main())


import math
datos = input()
num = ''
L = []
for numero in datos:
	if numero != ' ':
		num = num + numero
	else:
		L.append(int(num))
		num = ''
L.append(int(num))
if L[0] % 2 == 1:
	n = math.ceil(L[0] / 2)
else:
	n = L[0] / 2
if L[1] > n:
	numero = L[1] - n
	print(round(2 * numero))
else:
	numero = L[1] - 1
	print(round(2 * numero + 1))


(n, k) = input().split()
n = int(n)
k = int(k)
from math import *
pos = ceil(n / 2)
if n % 2 == 0:
	if k <= pos:
		print(2 * k - 1)
	else:
		print(2 * (k - pos))
if n % 2 == 1:
	if k < pos:
		print(2 * k - 1)
	elif k - pos == 0:
		print(n)
	else:
		print(2 * (k - pos))


(n, k) = map(int, input().split())
range_evens = n // 2
range_odds = n - range_evens
if k <= range_odds:
	print(2 * (k - 1) + 1)
else:
	print(2 * (k - range_odds))


import math
(n, k) = map(int, input().split())
t = math.ceil(n / 2)
if k > t:
	print((k - t) * 2)
if k < t + 1:
	print(k * 2 - 1)


(n, m) = map(int, input().split())
if n % 2 == 0:
	x = n // 2
else:
	x = n // 2 + 1
if m <= x:
	t = 1 + (m - 1) * 2
else:
	u = abs(m - x)
	t = 2 + (u - 1) * 2
print(t)


(n, k) = list(map(int, input().split(' ')))
output = 0
half_n = n // 2
if n % 2 == 0:
	if k <= half_n:
		output = 2 * k - 1
	else:
		output = 2 * (k - half_n)
elif k <= half_n + 1:
	output = 2 * k - 1
else:
	output = 2 * (k - half_n - 1)
print(output)


(n, k) = input().split()
n = int(n)
k = int(k)
if n % 2 == 0:
	lim = int(n / 2)
elif n % 2 != 0:
	lim = int(int(n / 2) + 1)
if k == 1:
	ans = 1
if k <= lim:
	ans = int(int(k * 2) - 1)
elif k > lim:
	ans = int((k - lim) * 2)
print(ans)


import math
[n, k] = list(map(int, input().split()))
temp = math.floor((n + 1) / 2)
if k <= temp:
	print(2 * k - 1, end='')
else:
	print(2 * (k - temp), end='')


arr = list(map(float, input().rstrip().split()))
k = arr[1]
if arr[0] % 2 == 0:
	if k <= arr[0] / 2:
		posnum = k
		print(int(2 * posnum - 1))
	else:
		posnum = k - int(arr[0] / 2)
		print(int(2 * posnum))
elif k <= int(arr[0] / 2) + 1:
	posnum = k
	print(int(2 * posnum - 1))
else:
	posnum = k - (int(arr[0] / 2) + 1)
	print(int(2 * posnum))


import math
info = input().split(' ')
integers = int(info[0])
position = int(info[1])
mid = math.ceil(integers / 2)
if position <= mid:
	print(2 * position - 1)
else:
	print((position - mid) * 2)


import math
test = input().split()
n = int(test[0])
k = int(test[1])
mid = math.ceil(n / 2)
if k > mid:
	print(str((k - mid) * 2))
else:
	print(str(k * 2 - 1))


inputme = input().split()
k = int(inputme[0])
n = int(inputme[1])
if k % 2 == 0:
	if n > k / 2:
		a = n - k / 2
		r = a * 2
		print(int(r))
	else:
		r = n * 2 - 1
		print(int(r))
elif n > (k + 1) / 2:
	a = n - (k + 1) / 2
	r = a * 2
	print(int(r))
else:
	r = n * 2 - 1
	print(int(r))


a = list(map(int, input().split()))
(n, k) = (a[0], a[1])
b = n // 2
if n % 2 == 0:
	if k <= b:
		print(k + k - 1)
	else:
		i = k - b
		print(2 * i)
elif k <= b + 1:
	print(k + k - 1)
else:
	print(2 * (k - b - 1))


inp = list(map(int, input().split()))
n = int(inp[0])
k = int(inp[1])
if n % 2 == 0:
	odd = int(n / 2)
else:
	odd = int(n / 2) + 1
if k < odd or k == odd:
	print(k * 2 - 1)
else:
	print((k - odd) * 2)


(n, k) = map(int, input().split())
evSt = int((n + 1) / 2 + 1)
if k < evSt:
	print(2 * k - 1)
else:
	k -= evSt
	print(2 * k + 2)


import math

def EvenOdds(n, k):
	if k <= math.ceil(n / 2):
		return 2 * k - 1
	else:
		return int(2 * (k - math.ceil(n / 2)))
(n, k) = [int(x) for x in input().split()]
print(EvenOdds(n, k))


from sys import stdin

def solve(tc):
	(n, k) = map(int, stdin.readline().split())
	odds = (n + 1) // 2
	if k <= odds:
		print(2 * (k - 1) + 1)
	else:
		print((k - odds) * 2)
tcs = 1
for tc in range(tcs):
	solve(tc)


(n, k) = map(int, input().split())
nechCount = n // 2 + n % 2
res = 0
if k <= nechCount:
	res = k + k - 1
else:
	i = k - nechCount
	res = i * 2
print(res)


import math
(length, term) = [int(x) for x in input().strip().split()]
x = 0
if term <= math.ceil(length / 2):
	print(2 * term - 1)
else:
	x = math.ceil(length / 2)
	x = term - x
	print(2 * x)


(a, b) = [int(x) for x in input().split(' ')]
i = 1
c = ''
if b <= (a + 1) / 2:
	print(2 * b - 1)
elif a % 2 == 0:
	b = b - a // 2
	print(2 * b)
else:
	b = b - (a + 1) // 2
	print(2 * b)


from math import ceil
(n, m) = map(int, input().split())
k = ceil(n / 2)
m1 = m - k
if m <= k:
	print(m * 2 - 1)
else:
	print(2 * m1)