n = int(input()) bit_num = int(input()) n = n | (1 << bit_num - 1) i = int(n ~ 1) print(i)