Problem:
 Score : 400 points    Problem Statement We have a pyramid with N steps, built with blocks.
The steps are numbered 1 through N from top to bottom.
For each 1≤i≤N , step i consists of 2i-1 blocks aligned horizontally.
The pyramid is built so that the blocks at the centers of the steps are aligned vertically.    A pyramid with N=4 steps   Snuke wrote a permutation of ( 1 , 2 , ... , 2N-1 ) into the blocks of step N .
Then, he wrote integers into all remaining blocks, under the following rule:   The integer written into a block b must be equal to the median of the three integers written into the three blocks directly under b , or to the lower left or lower right of b .     Writing integers into the blocks   Afterwards, he erased all integers written into the blocks.
Now, he only remembers that the integer written into the block of step 1 was x .  Construct a permutation of ( 1 , 2 , ... , 2N-1 ) that could have been written into the blocks of step N , or declare that Snuke's memory is incorrect and such a permutation does not exist.      Constraints  2≤N≤10^5  1≤x≤2N-1         Input The input is given from Standard Input in the following format:  N  x       Output If no permutation of ( 1 , 2 , ... , 2N-1 ) could have been written into the blocks of step N , print No .  Otherwise, print Yes in the first line, then print 2N-1 lines in addition.  The i -th of these 2N-1 lines should contain the i -th element of a possible permutation.        Sample Input 1 4 4      Sample Output 1 Yes
1
6
3
7
4
5
2  This case corresponds to the figure in the problem statement.       Sample Input 2 2 1      Sample Output 2 No  No matter what permutation was written into the blocks of step N , the integer written into the block of step 1 would be 2 .

Solution (Python):



def main():
    n, x = map(int, input().split())

    
    
    if (x == 1) or (x == (2 * n - 1)):
        print('No')
    else:
        print('Yes')

        numbers = [i for i in range(1, 2 * n - 1 + 1)
                   if (i < x - 1) or (x + 1 < i)]
        half = n - 2

        for ans in numbers[:half] + [x - 1, x, x + 1] + numbers[half:]:
            print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def b_median_pyramid_easy(N, X):
    
    if X in [1, 2 * N - 1]:
        return 'No'  
    if N == 2:
        return 'Yes\n1\n2\n3'
        

    ans_seq = [k for k in range(1, 2 * N)]
    if X == 2:
        
        
        tmp = [k for k in range(1, X - 1)] + [k for k in range(X + 3, 2 * N)]
        center = [X + 1, X, X - 1, X + 2]
    else:
        tmp = [k for k in range(1, X - 2)] + [k for k in range(X + 2, 2 * N)]
        center = [X - 1, X, X + 1, X - 2]
    ans_seq = tmp[:N - 2] + center + tmp[N - 2:]
    ans = 'Yes\n' + '\n'.join(map(str, ans_seq))
    return ans

N, X = [int(i) for i in input().split()]
print(b_median_pyramid_easy(N, X))

Solution (Python):
n,x = map(int,input().split())
if x == 1 or x == 2 * n - 1:
    print('No')
    exit()
print('Yes')
l = list(range(1, 2 * n))
l = l[-n+x:] + l[:-n+x]
print(*l, sep = '\n')

Solution (Python):


import math
import fractions
import heapq
import collections
import re
import array
import bisect

from collections import Counter, defaultdict


II = lambda: int(input())
MI = lambda: map(int, input().split())


def main():
    N, x = MI()
    if x in [1, 2 * N - 1]:
        print("No")
        return
    print("Yes")
    if N == 2:
        print("1\n2\n3")
        return
    s = set([i for i in range(1, 2 * N)])
    a = [None] * (2 * N - 1)
    MED = N - 1
    if x == 2 * N - 2:
        l = (x - 1, x, x + 1, x - 2)
        a[MED - 1:MED + 3] = l
        for i in l:
            s.remove(i)
    else:
        l = x + 1, x, x - 1, x + 2
        a[MED - 1:MED + 3] = l
        for i in l:
            s.remove(i)
    for i in range(2 * N - 1):
        if a[i] is None:
            a[i] = s.pop()
    for i in range(2 * N - 1):
        print(a[i])


if __name__ == "__main__":
    main()

Solution (Python):
N,x=map(int,input().split())

ANS=[]
for i in range(1,2*N):
    ANS.append(i)

if x==1 or x==(N*2-1):
    print("No")
else:
    print("Yes")
    if x==N:
        for j in range(len(ANS)):
            print(ANS[j])
    elif x<N:
        for j in range(1,N):
            if ANS[j]==x:
                pass
            else:
                print(ANS[j])
        print(1)
        print(x)
        for k in range(N,N*2-1):
            print(ANS[k])
    elif x>N:
        for j in range(N-1):
            print(ANS[j])
        print(x)
        print(N*2-1)
        for k in range(N-1,N*2-2):
            if ANS[k]==x:
                pass
            else:
                print(ANS[k])

Solution (Python):
import sys
from collections import deque
N,X=map(int,input().split())
if X==1 or X==2*N-1:
    print('No')
    sys.exit()
l=2*N-1
print('Yes')
if N==2:
    print(3)
    print(2)
    print(1)
    sys.exit()
if X==2:
    h=deque()
    h.append(3)
    h.append(2)
    h.append(1)
    h.append(4)
    s=0
    t=0
    while s!=N-2:
        t+=1
        if 4<t:
            s+=1
            h.appendleft(t)
    s=0
    while s!=N-3:
        t+=1
        if 4<t:
            s+=1
            h.append(t)
    print('\n'.join(map(str,h)))
    sys.exit()
    
h=deque()
h.append(X-1)
h.append(X)
h.append(X+1)
h.append(X-2)
s=0
t=0
while s!=N-2:
    t+=1
    if X+1<t or t<X-2:
        s+=1
        h.appendleft(t)
s=0
while s!=N-3:
    t+=1
    if X+1<t or t<X-2:
        s+=1
        h.append(t)
print('\n'.join(map(str,h)))

Solution (Python):
N,x=map(int,input().split())
if x==1 or x==2*N-1:
  print("No")
else:
  print("Yes")
  k=2
  c=0
  while c<=N-3:
    if k!=x:
      print(k)
      c+=1
    k+=1
  print(1)
  print(x)
  print(2*N-1)
  while c<=2*N-5:
    if k!=x:
      print(k)
      c+=1
    k+=1

Solution (Python):
n,x= map(int,input().split())
from collections import deque
if x == 2*n-1 or x == 1:
  print("No")
else:
  print("Yes")
  ans = deque([])
  ans.append(x)
  ans.appendleft(1)
  ans.append(2*n-1)
  for i in range(2,n):
    if x != i:
      ans.append(i)
    if x != 2*n-i:
      ans.appendleft(2*n-i)
  if x != n and x>n:
    ans.appendleft(n)
  if x != n and x<n:
    ans.append(n)
  for i in ans:
    print(i)

Solution (Python):
from collections import deque
N, x = map(int, input().split())
if x == 1 or x == 2*N-1: print("No")
else:
    A = deque([int(i) for i in range(1, 2*N)])
    Ans = [0 for i in range(2*N-1)]
    if x == 2:
        Ans[N-2], Ans[N-1], Ans[N] = 3, 2, 1
        A.remove(1)
        A.remove(2)
        A.remove(3)
        for i in range(2*N-1):
            if i < N-2 or i > N: Ans[i] = A.popleft()
    else:
        Ans[N-2], Ans[N-1], Ans[N], Ans[N+1] = x-1, x, x+1, x-2
        A.remove(x-1)
        A.remove(x)
        A.remove(x+1)
        A.remove(x-2)
        for i in range(2*N-1):
            if i < N-2 or i > N+1: Ans[i] = A.popleft()
    print("Yes")
    for a in Ans:print(a)

Solution (Python):
n,x = map(int,input().split())


if x in (1,2*n-1):
    print('No')
    exit()

res = [i for i in range(1,2*n)]

flag = False
if x > n:
    x = 2 * n - x
    flag = True

res = res[x-n:] + res[:x-n]

if flag:
    for i in range(2*n-1):
        res[i] = 2 * n - res[i]

print('Yes')
print(*res, sep='\n')

Solution (Python):
N, x = [int(i) for i in input().split()]
import sys

if x == 1 or x == 2*N-1:
    if N != 1:
        print('No')
        sys.exit()
    else:
        print('Yes')
        print(1)
        sys.exit()

smaller = True
if x > N:
    smaller = False
    x = 2*N-x

ans = list(range(2*N-1,N+x-1,-1))+list(range(1,N+x))
if not smaller:
    ans =[2*N - ans[i] for i in range(2*N-1)]

print('Yes')
for i in range(2*N-1):
    print(ans[i])

Solution (Python):

n,x = map(int, input().split())

if x==1 or x==2*n-1:
    print("No")
    exit()
if n==2:
    print("Yes")
    print(1)
    print(2)
    print(3)
    exit()

ret = [0 for _ in range(2*n-1)]
if x!=2:
    ret[n-1-1] = x-1
    ret[n-1] = x
    ret[n+1-1] = x+1
    ret[n+2-1] = x-2
    d = [x-2,x-1,x,x+1]
else:
    ret[n-1-1] = x+1
    ret[n-1] = x
    ret[n+1-1] = x-1
    ret[n+2-1] = x+2
    d = [x-1,x,x+1,x+2]
i = 0
j = 1
while i<2*n-1:
    if ret[i]==0:
        while j in d:
            j += 1
        ret[i] = j
        j += 1
    i += 1
print("Yes")
for x in ret:
    print(x)

Solution (Python):
n, x = map(int, input().split())

if x == 1 or x == 2*n-1:
    print('No')
else:
    print('Yes')
    m = n + 1
    l = n - 1
    a = [i+1 for i in range(2*n-1)]
    a[x-1] = a[n-1]
    a[n-1] = x
    if x < n:
        a[0] = a[n-2]
        a[n-2] = 1
        if n >= 3:
            a[2*n-2] = a[n-3]
            a[n-3] = 2*n-1
    else:
        a[2*n-2] = a[n]
        a[n] = 2*n-1
        if n >= 3:
            a[0] = a[n+1]
            a[n+1] = 1
    for i in range(2*n-1):
        print(a[i])

Solution (Python):
N, x = map(int, input().split())

if x in (1, 2*N-1):
    print('No')
else:
    print('Yes')
    ans = list(range(1, 2*N))
    st = (x-N) % (2*N-1)
    print('\n'.join(map(str, ans[st:] + ans[:st])))

Solution (Python):
n,x=map(int, input().split())
if x==1 or x==2*n-1:print('No')
else:
    print('Yes')
    a=list(range(1,2*n))
    b=[]
    b.append(a.pop(x))
    b.append(a.pop(x-1))
    b.append(a.pop(x-2))
    for i in a[:n-2]+b+a[n-2:]:
        print(i)

Solution (Python):
n, x = map(int, input().split())
if x == 1 or x == 2 * n - 1:
    print('No')
else:
    print('Yes')
    if n == 2:
        print(1, 2, 3, sep='\n')
        exit()
        
    if x == 2:
        a = [x + 1, x, x - 1, x + 2]
    else:
        a = [x - 1, x, x + 1, x - 2]
    b = list(set(range(1, 2 * n)) - set(a))
    for i in a[::-1]:
        b.insert(n - 2, i)
    print(*b, sep='\n')

Solution (Python):
N, x = map(int, input().split())
S = 2 * N - 1
if 1 < x < S:
    print('Yes')
    li = list(range(1, S + 1))
    print('\n'.join(map(str, li[x - N:] + li[:x - N])))
else:
    print('No')

Solution (Python):
N, x = map(int, input().split())
S = 2 * N - 1
if 1 < x < S:
    print('Yes')
    print(*[(a + x - N) % S + 1 for a in range(S)], sep='\n')
else:
    print('No')

Solution (Python):
N, x = map(int, input().split())

if x in [1, 2 * N - 1]:
    print('No')
else:
    print('Yes')
    center = {x - 1, x, x + 1}
    others = sorted(set(range(1, 2 * N)) - center)
    ans = others[N - 2:] + list(center) + others[:N - 2]
    print(*ans, sep='\n')

Solution (Python):
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n,x = li()

if n == 2 and x == 2:
    print("Yes")
    for i in range(1,4):
        print(i)
        
elif (n == 2 and x == 1) or (n == 2 and x == 3):
    print("No")

elif x == 1 or x == 2*n-1:
    print("No")

elif x == 2:
    ans = [i for i in range(1,x-1)] + [i for i in range(x+3, 2*n)]
    ans = ans[:n-2] + [x+2, x, x-1, x+1] + ans[n-2:]
    
    print("Yes")
    for ai in ans:
        print(ai)
    
else:
    ans = [i for i in range(1,x-2)] + [i for i in range(x+2, 2*n)]
    ans = ans[:n-2] + [x-1, x, x+1, x-2] + ans[n-2:]
    
    print("Yes")
    for ai in ans:
        print(ai)

Solution (Python):
f = lambda: map(int,input().split())
n,x = f()
import sys
if x == 1 or x == 2*n-1:
    print('No')
    sys.exit()
if n == 2:
    print(*['Yes',1,2,3], sep='\n')
else:
    print('Yes')
    a = list(range(1,x-1))+list(range(x+2,2*n))
    b = [x-1,x,x+1]
    c = a[n-2:]+b+a[:n-2]
    print(*c, sep='\n')

Solution (Python):
N,x=map(int,input().split())
if x==1 or x==2*N-1:
    print("No")
    exit()
print("Yes")
if N==2:
    for i in range(1,4):
        print(i)
    exit()
x-=1
A=[-1 for i in range(2*N-1)]
B=[0 for i in range(2*N-1)]
if x==1:
    A[N-2]=x+1
    A[N-1]=x
    A[N]=x-1
    A[N+1]=x+2
    for i in range(4):
        B[x-1+i]=1
else:
    A[N-2]=x-1
    A[N-1]=x
    A[N]=x+1
    A[N+1]=x-2
    for i in range(4):
        B[x-2+i]=1

C=[]
for i in range(2*N-1):
    if B[i]==0:
        C.append(i)
for i in range(2*N-1):
    if A[i]!=-1:
        continue
    A[i]=C[-1]
    C.pop()
for i in A:
    print(i+1)

Solution (Python):
n,x=map(int,input().split())

if n==2 and x==2:
  print("Yes",*[1,2,3],sep="\n")
elif x==1 or x>=2*n-1:
  print("No")
else:
  print("Yes")
  if x==2:
    t=[4,2,1,3]
  else:
    t=[x-1,x+1,x,x-2]
  p=[i for i in range(1,2*n) if i not in t]
  print(*p[:n-3]+t+p[n-3:],sep="\n")

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, X):
    if X == 1 or X == 2*N-1:
        print('No')
        return

    a = list(range(1, 2*N))
    if N == 2:
        if a.index(X) != 1:
            print('No')
            return

    else:
        ci = 2*N//2 - 1
        xi = a.index(X)
        a[xi], a[ci] = a[ci], a[xi]

        if X != 2*N-2:
            xm1i = a.index(X-1)
            a[xm1i], a[ci-1] = a[ci-1], a[xm1i]

            xp1i = a.index(X+1)
            a[xp1i], a[ci-2] = a[ci-2], a[xp1i]

            xp2i = a.index(X+2)
            a[xp2i], a[ci+1] = a[ci+1], a[xp2i]
        else:
            xm1i = a.index(X+1)
            a[xm1i], a[ci-1] = a[ci-1], a[xm1i]

            xp1i = a.index(X-1)
            a[xp1i], a[ci-2] = a[ci-2], a[xp1i]

            xp2i = a.index(X-2)
            a[xp2i], a[ci+1] = a[ci+1], a[xp2i]

    print('Yes')
    for v in a:
        print(v)


def main():
    N, X = read_int_n()
    slv(N, X)


if __name__ == '__main__':
    main()

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, X):
    if X == 1 or X == 2*N-1:
        print('No')
        return

    a = list(range(1, 2*N))
    if N == 2:
        if a.index(X) != 1:
            print('No')
            return

    else:
        ci = 2*N//2 - 1
        xi = a.index(X)
        a[xi], a[ci] = a[ci], a[xi]

        if X != 2*N-2:
            xm1i = a.index(X-1)
            a[xm1i], a[ci-1] = a[ci-1], a[xm1i]

            xp1i = a.index(X+1)
            a[xp1i], a[ci-2] = a[ci-2], a[xp1i]

            xp2i = a.index(X+2)
            a[xp2i], a[ci+1] = a[ci+1], a[xp2i]
        else:
            xm1i = a.index(X+1)
            a[xm1i], a[ci-1] = a[ci-1], a[xm1i]

            xp1i = a.index(X-1)
            a[xp1i], a[ci-2] = a[ci-2], a[xp1i]

            xp2i = a.index(X-2)
            a[xp2i], a[ci+1] = a[ci+1], a[xp2i]

    print('Yes')
    for v in a:
        print(v)


def main():
    N, X = read_int_n()
    slv(N, X)


if __name__ == '__main__':
    main()

Solution (Python):
n, x = map(int, input().split())


def calc(a):
    b = []
    for i in range(len(a)-2):
        b.append(list(sorted(a[i:i+3]))[1])
    if len(b) == 1:
        return b[0]
    else:
        return calc(b)
"""
n = 5
max_ = []
for i in range(n):
    max_.append(i*2+1)

for i in range(n-1, 0, -1):
    max_.append(i*2)

print(calc(max_))
"""

if x == 1 or x == 2*n-1:
    print("No")
    exit()
print("Yes")

if x == 2:
    center = 2
    r1 = 1
    r2 = 3
    l = 4
else:
    center = x
    r1 = x+1
    r2 = 1
    l = 2

ans = []
y = 1
for i in range(n-2):
    while y in [center, r1, r2, l]:
        y+= 1
    ans.append(y)
    y+=1
ans.append(l)
ans.append(center)
ans.append(r1)
ans.append(r2)
for i in range(n-3):
    while y in [center, r1, r2, l]:
        y+=1
    ans.append(y)
    y+=1
if n == 2:
    ans = [1,2,3]
for x in ans:
    print(x)

Solution (Python):
def main():
    n, x = map(int, input().split())

    if x == 1 or x == 2 * n - 1:
        print("No")
    elif x == 2:
        print("Yes")
        lst = [i for i in range(1, x-1)] + [i for i in range(x+3, 2*n)]
        for i in range(n-2):
            print(lst[i])
        print(x+1)
        print(x)
        print(x-1)
        if n >= 3:
            print(x+2)
        for i in range(n+2, 2*n-1):
            print(lst[i-4])
    else:
        print("Yes")
        lst = [i for i in range(1, x-2)] + [i for i in range(x+2, 2*n)]
        for i in range(n-2):
            print(lst[i])
        print(x-1)
        print(x)
        print(x+1)
        print(x-2)
        for i in range(n+2, 2*n-1):
            print(lst[i-4])


if __name__ == '__main__':
    main()

Solution (Python):
n, x = [int(i) for i in input().split()]

if x == 1 or x == 2*n-1:
    print('No')
    exit()

A = [i for i in range(0, 2*n)]

A[n], A[x] = x, A[n]
i = A.index(x-1)
A[n-1], A[i] = A[i], A[n-1]
i = A.index(x+1)
A[n+1], A[i] = A[i], A[n+1]

print('Yes')

for i in range(1, 2*n):
    print(A[i])

Solution (Python):
n, x = map(int, input().split())
if 1 < x < 2 * n - 1:
	print("Yes")
	others = list(range(1, x - 1)) + list(range(x + 2, 2 * n))
	for i in range(n - 2):
		print(others[i])
	print(x - 1)
	print(x)
	print(x + 1)
	for i in range(n + 1, 2 * n - 1):
		print(others[i - 3])
else:
	print("No")

Solution (Python):
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, x] =  [long(input_raw[0]), long(input_raw[1])]
    if x <= 1 or x >= 2*N - 1:
        print 'No'

    else:
        print 'Yes'
        l = [0 for i in range(2*N - 1)]
        m = (2*N-1)/2
        l[m] = x
        already_set = set([x])


        if x + 2 <= 2 * N - 1:
            if m - 1 >= 0:
                l[m - 1] = x + 1
                already_set.add(x + 1)
            if m + 1 < 2*N - 1:
                l[m + 1] = x - 1
                already_set.add(x - 1)
            if m + 2 < 2*N - 1:
                l[m + 2] = x + 2
                already_set.add(x + 2)
        else:
            if m - 1 >= 0:
                l[m - 1] = x - 1
                already_set.add(x - 1)
            if m + 1 < 2*N - 1:
                l[m + 1] = x + 1
                already_set.add(x + 1)
            if m + 2 < 2*N - 1:
                l[m + 2] = x - 2
                already_set.add(x - 2)

        a = 1
        for i in range(2 * N - 1):
            if l[i] == 0:
                while a <= 2*N - 1 :
                    if a not in already_set:
                        print a
                        a += 1
                        break;
                    else:
                        a += 1
            else:
                print l[i]



if __name__ == '__main__':
    main()

Solution (Python):
N, X = [int(_) for _ in input().split()]

from itertools import permutations

def calc(x):
    def sub(y, debug=0):
        if debug:
            print("D", y)
        while len(y) > 1:
            y = [sorted(y[i:i+3])[1] for i in range(len(y) - 2)]
            if debug:
                print("D", y)
        return y
    y = sub(x)
    return y[0]

if X == 1 or X == N * 2 - 1:
    print("No")
else:
    print("Yes")
    if X == N * 2 - 2:
        xs = list(range(N - 1, X + 2)) + list(range(1, N - 1))
    else:
        ys = list(range(1, X - 1)) + list(range(X + 3, N * 2))
        xs = ys[:N-3] + [X + 2, X - 1, X, X + 1] + ys[N-3:]
    for x in xs:
        print(x)

Solution (Python):
N, X = [int(_) for _ in input().split()]

from itertools import permutations

def calc(x):
    
    def sub(y, debug=0):
        if debug:
            print("D", y)
        while len(y) > 1:
            y = [sorted(y[i:i+3])[1] for i in range(len(y) - 2)]
            if debug:
                print("D", y)
        return y
    y = sub(x)
    if y[0] == 2:
        pass
        sub(x, 1)
        print("=", x)
    return y[0]





if X == 1 or X == N * 2 - 1:
    print("No")
else:
    print("Yes")
    if X == N * 2 - 2:
        xs = list(range(N - 1, X + 2)) + list(range(1, N - 1))
    else:
        ys = list(range(1, X - 1)) + list(range(X + 3, N * 2))
        xs = ys[:N-3] + [X + 2, X - 1, X, X + 1] + ys[N-3:]
    for x in xs:
        print(x)

"""
3 4
1 2 3 4 5
2 3 4 5 1
4 4

"""

Solution (Python):
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect
from random import *

def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]

N, x = reads()
if x == 1 or x == 2*N-1:
  print('No'); exit()

print('Yes')
zs = [i for i in range(2, 2*N-1) if i != x]
for z in chain(zs[:N-2], [1, x, 2*N-1], zs[N-2:]):
  print(z)

Solution (Python):
N, x = map(int, input().split())
if N == 2:
    if x == 2:
        print("Yes")
        for i in range(1,4):
            print(i)
    else:
        print("No")
    exit()
if 1 < x < 2*N-1:
    print("Yes")
    if x == 2:
        E = [3, 1, 2, 4]
    else:
        E = [x-1, x+1, x, x-2]
    P = [i for i in list(range(1, N*2)) if i not in E]
    P = P[:N-3] + E + P[N-3:]
    for p in P:
        print(p)
else:
    print("No")

Solution (Python):
N,x=map(int,input().split())
if x==1 or x==2*N-1:
  print("No")
else:
  print("Yes")
  ans=[int(x+1) for x in range(2*N-1)]
  if N-x > 0:
    cnt=abs(N-x)
    ans=ans[(2*N-1)-cnt:]+ans[:(2*N-1)-cnt]
  elif N-x < 0:
    cnt=abs(N-x)
    ans=ans[cnt:]+ans[:cnt]
  for i in range(2*N-1):
    print(ans[i])

Solution (Python):
n,x = (int(i) for i in input().split())
if x==1 or x==2*n-1: print("No")
else:
	print("Yes")
	for i in range((x+n-1)%(2*n-1),0,-1): print(i)
	for i in range(2*n-1,(x+n-1)%(2*n-1),-1): print(i)

Solution (Python):
N, x = map(int, input().split())

if x == 1 or x == 2*N-1:
    print("No")
    exit()
else:
    print("Yes")
    if N == 2:
        for i in range(3):
            print(i+1)
        exit()
    count = 0
    for i in range(2,2*N-1):
        if i == x:
                continue
        else:
            print(i)
            count += 1

        if count == N-1:
            if x > N:
                print(2*N-1)
                print(x)
                print(1)
            else:
                print(1)
                print(x)
                print(2*N-1)

Solution (Python):
N, x = map(int, input().split())

if x == 1 or x == 2*N-1:
    print("No")
else:
    print("Yes")
    center = [x-1, x, x+1]
    left = list(range(1, x-1))
    right = list(range(x+2, 2*N))
    others = left + right

    ans = others[N-2:] + center + others[:N-2]
    print(*ans, sep="\n")

Solution (Python):
def getPermutation(n, x):
    if x==1 or x==n*2-1:
        return None
    if n==2:
        return [1, 2, 3]
    if x==2:
        bar = [x+1, x-1, x, x+2]
    else:
        bar = [x-1, x+1, x, x-2]
    rem = [i for i in xrange(1, n*2) if i not in bar]
    return rem[:n-2]+bar+rem[n-2:]

def main():
    n, x = [int(i) for i in raw_input().strip().split()]
    res = getPermutation(n, x)
    if res is None:
        print 'No'
    else:
        print 'Yes'
        for i in res:
            print i

if __name__ == '__main__':
    main()

Solution (Python):

N, x = map(int, input().split())
if 1 < x < 2 * N - 1:
    print('Yes')
    order = (1, -1)[x > N]
    l = list(range(1, 2 * N)[::order])
    for i in range(2 * N - 1):
        print(l[i - abs(x - N)])
else:
    print('No')

Solution (Python):
n, x = map(int,input().split())
assert n >= 2
if x==1 or x==2*n-1:
    print('No')
else:
    a = [x-1,x,x+1]
    b = list(range(1,x-1))+list(range(x+2,2*n))
    ans = b[n-2:]+a +b[:n-2]
    print('Yes')
    print(*ans,sep='\n')

Solution (Python):
N,X = map(int,input().split())
if X in (1,2*N-1):
    print('No')
    exit()

print('Yes')
if N == 2:
    for i in range(3): print(i+1)
    exit()

ans = [None] * (2*N-1)
if X == 2:
    ans[N-2:N+2] = [3,2,1,4]
    n = 5
    for i in range(2*N-1):
        if ans[i] is not None: continue
        ans[i] = n
        n += 1
else:
    ans[N-2:N+2] = [X-1,X,X+1,X-2]
    n = X+2
    for i in range(2*N-1):
        if ans[i] is not None: continue
        ans[i] = (n-1)%(2*N-1) + 1
        n += 1
for a in ans:
    print(a)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def solve(N, x):
    que = deque(list(i for i in range(1, 2 * N) if i != x))
    ans = deque([x])
    i = 0
    while que:
        a = que.popleft()
        b = que.pop()
        if i % 2 == 0:
            ans.appendleft(a)
            ans.append(b)
        else:
            ans.appendleft(b)
            ans.append(a)
        i += 1
    return ans


def main():
    N, x = map(int, input().split())
    if 1 < x < 2 * N - 1:
        print("Yes")
        print(*solve(N, x), sep="\n")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):

n, x = map(int,input().split())
assert n >= 2
if x == 1 or x == 2 * n - 1:
    print('No')
else:
    a = [ x - 1, x, x + 1 ]
    b = list(range(1, x - 1)) + list(range(x + 2, 2 * n))
    c = b[n - 2 :] + a + b[: n - 2]
    print('Yes')
    print(*c, sep='\n')

Solution (Python):

import sys
if __name__ == "__main__":

	N,X = map(int, input().split())
	res = 2 * N - 1
	if (X == 1 or X == 2 * N - 1):
		print ("No")
		sys.exit()
	result = [0] * res
	left = X - 1
	result[N-1] = X
	right = X + 1
	left_idx = N - 2
	right_idx = N

	cnt = 0
	while (left > 0 and right < 2 * N):
		if (cnt % 2 == 0):
			result[left_idx] = left
			result[right_idx] = right
		else:
			result[left_idx] = right
			result[right_idx] = left

		left_idx -= 1
		left -= 1

		right_idx += 1
		right += 1

		cnt += 1
	if (left > 0):
		for x in range(left_idx, -1, -1):
			result[x] = left
			left -= 1
		for x in range(right_idx, 2 * N-1):
			result[x] = left
			left -= 1
	if (right < 2 * N):
		for x in range(left_idx, -1, -1):
			result[x] = right
			right += 1
		for x in range(right_idx, 2 * N-1):
			result[x] = right
			right += 1

	print ("Yes")
	for x in result:
		print (x)

Solution (Python):
import sys
if __name__ == '__main__':
    N,x = list(map(int,input().split()))
    if 1 < x < 2*N - 1:
        print('Yes')
        for i in range(2*N - 1):
            print(1+ ((x-N+i)%(2*N - 1)))
    else:
        print('No')

Solution (Python):
n,x=map(int,input().split())
if not (2 <= x <= 2*n-2):
    print('No')
    exit(0)
print('Yes')
ans = []
if n == 2:
    ans = [1,2,3]
else:
    d=[i for i in range(1,2*n)]
    ans=[0]*(2*n-1)
    v=[]
    if x > 2:
        v = [x-1, x, x+1, x-2]
    else:
        v = [x+2, x, x-1, x+3]
    for w in v:
        d.remove(w)
    ans[n-2:n+2] = v
    for i in range(2*n-1):
        if ans[i] == 0:
            ans[i] = d.pop()
for v in ans:
    print(v)

Solution (Python):
import sys

N, x = map(int, input().split())
if x == 1 or x == 2 * N - 1:
    print("No")
    sys.exit()
if N == 2:
    print("Yes")
    print(1)
    print(2)
    print(3)
    sys.exit()

print("Yes")
n = 2 * N - 1
ans = [None] * n
tmp = ans[n//2-1:n//2+3]

if x != 2 * N - 2:
    tmp[0] = x + 1
    tmp[1] = x
    tmp[2] = x - 1
    tmp[3] = x + 2
else:
    tmp[0] = x - 1
    tmp[1] = x
    tmp[2] = x + 1
    tmp[3] = x - 2
cnt = 1

ans[n//2-1:n//2+3] = tmp
for i in range(n):
    if x != 2 *  N - 2:
        if cnt == x-1:
            cnt += 4
    else:
        if cnt == x-2:
            cnt += 4
    if ans[i] is None:
        ans[i] = cnt
        cnt += 1

for i in ans:
    print(i)

Solution (Python):
n,x=map(int,raw_input().split());m=2*n-1
if x in [1,m]:print'No'
else:
 print'Yes'
 for i in range(m):print(x+n-1+i)%m+1

Solution (Python):
n,x=map(int,raw_input().split());m=2*n-1
if x in [1,m]:print'No'
else:
 print'Yes'
 for i in range(x+n-1,x+3*n-2):print i%m+1

Solution (Python):
N,x=map(int,input().split())
if x==1 or x==2*N-1:
    print('No')
elif N==2:
    print('Yes')
    for i in range(-1,2):
        print(x-i)
        
elif N>=3 and x==2:
    print('Yes')    
    a=[i for i in range(1,N*2)]
    del a[x-2:x+2]

    for i in range(N-2):
        print(a[i])

    print(x+1)
    print(x)
    print(x-1)
    print(x+2)
    
    for i in range(N+3,2*N):
        print(a[i-5])
else:
    print('Yes')    
    a=[i for i in range(1,N*2)]
    del a[x-3:x+1]

    for i in range(N-2):
        print(a[i])

    print(x-1)
    print(x)
    print(x+1)
    print(x-2)
    
    for i in range(N+3,2*N):
        print(a[i-5])

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    r = []
    n,x = list(map(int, input().split()))
    nn = n*2
    if x < 2 or x > nn-2:
        return 'No'
    print('Yes')
    r = list(range(1,nn))
    r[n-1],r[x-1] = r[x-1],r[n-1]
    r[n-2],r[0] = r[0],r[n-2]
    r[n],r[-1] = r[-1],r[n]
    return " ".join(map(str,r))


print(f())

Solution (Python):
N,X=map(int,input().split());S=2*N-1;print(*[['No'],['Yes']+[1+(X-N+K)%S for K in range(S)]][1<X<S],sep='\n')

Solution (Python):
n, x = map(int, input().split())
s = 2*n - 1
if 1 < x < s:
    print('Yes')
    for i in range(s):
        print(1 + (x - n + i) % s)
else:
    print('No')

Solution (Python):
n,x=map(int,raw_input().split())
if x in [1,2*n-1]:
    print "No"
    exit(0)
A=range(1,2*n)
if x<n:
    A[x-2:min(x+2,n-2)],A[n-2:n+2] = A[max(n-2,x+2):n+2],A[x-2:x+2]
    if n>2: A[n-2],A[n-1:n+1] = A[n],A[n-2:n]
if n<x:
    A[n-3:n+1],A[max(x-3,n+1):x+1] = A[x-3:x+1],A[n-3:min(n+1,x-3)]
    if n>2: A[n-2:n],A[n] = A[n-1:n+1],A[n-2]
print "\n".join(["Yes"]+map(str, A))

Solution (Python):
N, K = map(int, input().split())
m = 2 * N - 1

if 2 <= K < m:
    mid = list((3, 2, 1) if K == 2 else (K - 1, K, K + 1, K - 2))
    a = list(set(range(1, m + 1)) - set(mid))
    print("Yes\n" + "\n".join(map(str, a[:m//2 - 1] + mid + a[m//2 - 1:])))
else:
    print("No")