LearnPy Hub
← Arena
EasyRating 900

Odds Then Evens

Write the numbers 1 to n with all the odd numbers first (in order), then the even numbers. Which number is in position k?

Input

Two integers n and k (1 ≤ k ≤ n ≤ 10¹²).

Output

One integer.

Sample 1

Input
10 3
Output
5

Sample 2

Input
7 7
Output
6
solution.py
Output appears here
Odds Then Evens · Python Arena problem · LearnPy Hub