n, k = map(int, input().split()) print((k - 1) * 2 - (n == k))