Odds and Ends


Submit solution


Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

Mitchell is a keen fan of absurd comedy, eccentricity and is generally displeased with a great many things. In particular, Mitchell is disgusted by the order of natural numbers (positive integers) and would like to rearrange them. There are too many natural numbers to do this in one move so Mitchell starts with the first \(n\). He writes down the following sequence: all even integers from \(2\) to \(n\) (ascending), then all odd integers from \(1\) to \(n\) (descending). Help Mitchell, the last bastion of sense in this tumultuous world, find out which number will stand at the position number \(k\).

Input Specification

One line. Two integers \(n\) and \(k\) (\(1 \leq k \leq n \leq 10^{12}\)).

Output Specification

Print the number standing at position number \(k\) after Mitchell's manipulations.

Sample Input 1

10 5

Sample Output 1

10

Sample Input 2

10 10

Sample Output 2

1

Note

In both samples, the sequence would look like {2, 4, 6, 8, 10, 9, 7, 5, 3, 1} and is indexed from position \(1\) to \(n\).


Comments

There are no comments at the moment.