The program must accept two integer N and K as input. The program must containing all the odd integer from 1 to N followed by all even integer from 1 to N.Then the program must print the K th integer in sequence as the output.

EXAMPLE INPUT/OUTPUT 1:

INPUT:

10 3

OUTPUT

5

Explanation:

N=10,so sequence is 1 3 5 7 9 2 4 6 8 10

third integer in the sequence is 5.

EXAMPLE INPUT/OUTPUT 2:

INPUT:

7 7

OUTPUT

6


CODE:

#include<stdio.h>
#include <stdlib.h>

int main()
{
int N,K,j=0;
scanf("%d %d",&N,&K);
for(int i=1;i<=N;i=i+2)
{
    j++;
    if(j==K)
    {
        printf("%d",i);
        return 0;
    }
}
for(int i=2;i<=N;i=i+2)
{
    j++;
    if(j==K)
    {
        printf("%d",i);
        break;
    }
}

}