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):
n,x=map(int, input().split())
if x==1 or x==2*n-1:
    print('No')
    exit()
from collections import deque
ll=deque()
for i in range(n+1,2*n):
    if x!=i and len(ll)<n:
        ll.append(i)

ll.append(x)
for i in range(1,n):
    if x!=i:
        ll.append(i)
if x<n:
    ll.append(n)
elif x>n:
    ll.appendleft(n)
print("Yes")
for i in ll:
    print(i)

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():

    N, x = in_nn()
    max_n = 2 * N - 1

    if x == 1 or x == max_n:
        print("No")
        exit()

    if x < N:
        ans = []
        pyr = set(range(1, max_n + 1))
        center = [x + 2, x + 1, x, x - 1, x + 3]
        pyr -= set(center)
        pyr = list(pyr)
        t_len = (max_n - 5) // 2
        ans = pyr[:t_len] + center + pyr[t_len:]
    elif x == N:
        ans = list(range(1, max_n + 1))
    elif x > N:
        ans = []
        pyr = set(range(1, max_n + 1))
        center = [x - 2, x - 1, x, x + 1, x - 3]
        pyr -= set(center)
        pyr = list(pyr)
        t_len = (max_n - 5) // 2
        ans = pyr[:t_len] + center + pyr[t_len:]

    print("Yes")
    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()

Solution (Python):
n, x = map(int, input().split())
if x == 1 or x == n * 2 - 1:
    print('No')
else:
    print('Yes')
    ans = [0] * (n * 2 - 1)
    used = [False] * (n * 2)
    mid = n - 1
    ans[mid] = x
    used[x] = True
    if x == 2:
        ans[mid - 1] = 3
        ans[mid + 1] = 1
        used[1] = used[3] = True
    else:
        ans[mid - 1] = 1
        ans[mid + 1] = n * 2 - 1
        ans[mid + 2] = 2
        used[1] = used[2] = used[n * 2 - 1] = True

    num = 1
    for i in range(n * 2 - 1):
        while num < n * 2 and used[num]:
            num += 1
        if ans[i] == 0:
            ans[i] = num
            used[num] = True

    print(*ans)

Solution (Python):

def main():
    n,x=map(int,input().split())
    j = 1
    if(x == 1 or x == 2 * n - 1):
        print("No")
        return 0
    print("Yes")
    ans=[]
    for i in range(n-2):
        if(j == x - 1):
            j += 3
        ans.append(j)
        j+=1
    ans+=[x-1,x,x+1]
    for i in range(n-2):
        if(j == x - 1):
            j += 3
        ans.append(j)
        j+=1
    print(*ans)
    return 0
main()

Solution (Python):
N, x = list(map(int, input().split()))
M = N * 2 - 1

if x == 1 or x == M:
  print("No")
  exit()

L = [i + 1 for i in range(M)]

n = N - 1
L[n], L[x - 1] = L[x - 1],L[n]
L[n - 1], L[0] = L[0], L[n - 1]
L[n + 1], L[M - 1] = L[M - 1], L[n + 1]

print("Yes")
for i in L:
  print(i)

Solution (Python):
N, x = map(int, input().split())
if x==1 or x==2*N-1:
    print("No")
else:
    print("Yes")
    res = [0]*(2*N-1)
    res[N-2]=1
    res[N-1]=x
    res[N]=2*N-1
    k=1
    for i in range(2*N-1):
        if i not in {N-2,N-1,N}:
            while k in {1,x,2*N-1}:
                k+=1
            res[i] = k
            k += 1
    print(*res, sep="\n")

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

Solution (Python):

N,i = map(int,input().split())
i -= 1
N -= 1

if i == 0 or i == 2*N:
    print('No')
    exit()

res = list(range(2*N+1))
if i > N:
    res = res[i-N:]+res[:i-N]
else:
    res = res[i+N+1:]+res[:i+N+1]

res[N+1],res[N-1] = res[N-1],res[N+1]

print('Yes')
print(*(a+1 for a in res), sep='\n')

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


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

print('Yes')
A = [i for i in range(1,2*N)]
A = A + A + A
print(*A[x+N-1:x+3*N-2],sep='\n')

Solution (Python):
N,x = map(int,input().split())
if x == 1 or x == 2*N-1:
    print("No")
else:
    lis = [0 for _ in range(2*N-1)]
    lis[N-1] = x
    lis[N] = x-1
    lis[N-2] = x+1
    count = 1
    for i in range(2*N -1):
        if count == x-1:
            count = x+2
        if abs(N-i-1) <= 1:
            None
        else:
            lis[i] = count
            count+=1
    print("Yes")
    for j in lis:
        print(j)

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

ans = [None] * (2*N-1)
ans[N-2] = X-1
ans[N-1] = X
ans[N] = X+1
a = 1
for i in range(2*N-1):
    if ans[i]: continue
    if a==X-1:
        a += 3
    ans[i] = a
    a += 1
print(*ans, sep='\n')

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

if N == 2:
    if x == 2:
        print("Yes")
        print(1)
        print(2)
        print(3)
    else:
        print("No")

else:
    from collections import deque
    used = [True] + [False] * (2 * N)
    if x == 1 or x == 2*N-1:
        print("No")
        exit()
    elif x == 2:
        ans = deque([3, 1, 2, 4, 5])
        for i in range(1, 6):
            used[i] = True
    elif x == 3:
        ans = deque([4, 1, 3, 5, 2])
        for i in range(1, 6):
            used[i] = True
    else:
        ans = deque([x-3, x-1, x, x+1, x-2])
        for i in range(-3, 2):
            used[x+i] = True

    p = 0
    for i in range(2*N):
        if not used[i]:
            p^=1
            if p:
                ans.append(i)
            else:
                ans.appendleft(i)

    print("Yes")
    for e in list(ans):
        print(e)

Solution (Python):
from collections import deque
n,x = map(int, input().split())

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

if x == 2:
    ansl = []
    q = deque()
    for i in range(5,2*n):
        q.append(i)
    for i in range(0,2*n-1):
        if i == n-2: ansl.append(3)
        elif i == n-1: ansl.append(2)
        elif i == n: ansl.append(1)
        elif i == n+1: ansl.append(4)
        else: ansl.append(q.pop())
        

else:
    ansl = []
    q = deque()
    fix = [x-1,x,x+1,x-2]
    for i in range(1,2*n):
        if i not in fix:
            q.append(i)
    for i in range(0,2*n-1):
        if i == n-2: ansl.append(x-1)
        elif i == n-1: ansl.append(x)
        elif i == n: ansl.append(x+1)
        elif i == n+1: ansl.append(x-2)
        else: ansl.append(q.pop())

print('Yes')
print(*ansl)

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  


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

print('Yes')
A = [i for i in range(1,2*N)]
A = A + A + A
print(*A[x+N-1:x+3*N-2],sep='\n')

Solution (Python):
import sys
from statistics import median

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
res = 0


def resolve():
    def dfs(S):
        """ デバッグ用 """
        global res
        if len(S) == 1:
            res = S[0]
            return

        tmp = []
        for i in range(1, len(S) - 1):
            t = median([S[i - 1], S[i], S[i + 1]])
            tmp.append(t)
        dfs(tmp)

    n, x = map(int, input().split())
    if x == 1 or x == 2 * n - 1:
        print("No")
        exit()
    n = 2 * n - 1
    ans = [0] * n
    num = x
    for i in range(n // 2, n):
        ans[i] = num
        num += 1
        if num > n:
            num = 1
    for i in range(n // 2):
        ans[i] = num
        num += 1
        if num > n:
            num = 1
    print("Yes")
    print(*ans, sep="\n")
    
    


if __name__ == '__main__':
    resolve()

Solution (Python):
from collections import deque
N,x=map(int,input().split())
if x==1 or x==2*N-1:
    print("No")
    exit()
if N==2:
    print('Yes')
    print(*[1,2,3],sep='\n')
    exit()
    
d=deque(list(range(1,x))+list(range(x+1,2*N)))
ans=[0]*(2*N-1)
ans[N-1]=x
ans[N-2],ans[N]=[d.popleft(),d.pop()] if x>2 else [d.pop(),d.popleft()]
ans[N+1]=d.popleft() if N>2 else d.pop()

for i in range(2*N-1):
    if ans[i]==0:
        ans[i]=d.pop()
print("Yes")
print(*ans,sep='\n')

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,2,3],sep='\n')
    exit()
s=set(range(1,2*N))
s.remove(x)
ans=[0]*(2*N-1)
ans[N-1]=x
min1=min(s)
max1=max(s)
s.remove(min1);s.remove(max1)
if x==2*N-2:
    min2=min(s)
    s.remove(min2)
    ans[N-2]=min1;ans[N]=max1;ans[N+1]=min2
else:
    max2=max(s)
    s.remove(max2)
    ans[N-2]=max1;ans[N]=min1;ans[N+1]=max2
li=list(s)
for i in range(2*N-1):
    if ans[i]==0:
        ans[i]=li.pop()
print("Yes")
print(*ans,sep='\n')

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, 4):
    print(i)

else:
  if x == 2:
    ans = [3, 1, 2, 4]
  else:
    ans = [x-1, x, x+1, x-2]
  key = []
  for i in range(1, 2*n):
    if i in ans:
      continue
    key.append(i)
  ans = key[:len(key)//2] + ans + key[len(key)//2:]
  
  print("Yes")
  for a in ans:
    print(a)

Solution (Python):
def main():
  n, x = map(int, input().split())
  if x == 1 or x == 2*n-1:
    print("No")
    return 0
  print("Yes")
  if n == 2:
    ans = [1, 2, 3]
  elif n >= 3 and (x == 2 or x == 2*n-2):
    if x == 2:
      ans = [3, 2, 1, 4]
      key = [int(x) for x in range(5, 2*n)]
      key, key2 = list(reversed(key[:len(key)//2])), key[len(key)//2:]
      ans = key+ans+key2
    else:
      ans = [2*n-3, 2*n-2, 2*n-1, 2*n-4]
      key = [int(x) for x in range(1, 2*n-4)]
      key, key2 = list(reversed(key[:len(key)//2])), key[len(key)//2:]
      ans = key+ans+key2
  else:
    ans = [x-2, x+1, x, x-1, x+2]
    key = [int(x) for x in range(1, x-2)] + [int(x) for x in range(x+3, n*2)]
    ans = key[len(key)//2:]+ans+key[:len(key)//2]
  for a in ans:
    print(a)
  
if __name__ == "__main__":
  main()

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

Solution (Python):
N,x=map(int, input().split())
if x==1 or x==2*N-1:
  print('No')
  exit()
print('Yes')
if N>2:
  n=2*N-1
  ans=[0]*n
  if x>2:
    num=1
    ans[N-3]=x-1
    ans[N-2]=x+1
    ans[N-1]=x    
    ans[N]=x-2
    for i in range(2*N-1):
      if ans[i]!=0:
        print(ans[i])
      else:
        if num==x-2:
          num+=4
        print(num)
        num+=1
  else:
    num=2*N-1
    ans[N-3]=3
    ans[N-2]=1
    ans[N-1]=2    
    ans[N]=4
    for i in range(2*N-1):
      if ans[i]!=0:
        print(ans[i])
      else:
        print(num)
        num-=1
else:
  for i in range(1,4):
    print(i)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, x = MAP()

if x == 1 or x == 2*N-1:
    print("No")
else:
    print("Yes")
    ans = deque([1, x, 2*N-1])
    for i in range(2, 2*N-1):
        if i == x: continue
        if (i+(x!=2*N-2))%2:
            ans.append(i)
        else:
            ans.appendleft(i)

    print(*ans, sep="\n")

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

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

if x == 1 or x == 2 * N - 1:
  print("No")
else:
  a = [0] * (2 * N - 1)
  a[N - 1] = x
  a[N - 2] = 1
  a[N] = 2 * N - 1
  pos = 0
  for i in range(2 * N - 1):
    while pos < 2 * N - 1 and a[pos]:
      pos += 1
    if i + 1 == 1 or i + 1 == 2 * N - 1 or i + 1 == x:
      continue
    a[pos] = i + 1
  
  print("Yes")
  for d in a:
    print(d)

Solution (Python):
def mid(x, y, z):
    if x <= y <= z or z <= y <= x:
        return y
    elif y <= x <= z or z <= x <= y:
        return x
    return z

def test():
    from random import shuffle
    for _ in range(5):
        arr = [i for i in range(1, 11 + 1)]
        shuffle(arr)
        print(arr, end=" : ")
        while len(arr) > 1:
            tmp = [mid(arr[i], arr[i+1], arr[i+2]) for i in range(len(arr)-2)]
            arr = tmp
        print(arr[0])

def main():
    n, x = map(int, input().split())
    if x == 1 or x == 2*n-1:
        print("No")
    else:
        print("Yes")
        if n == 2:
            for i in range(1, 4):
                print(i)
        else:
            ans = [None]*(2*n - 1)
            st = set(i for i in range(1, 2*n))
            ans[n-1] = x
            st.remove(x)
            if x == 2:
                ans[n-3] = 4
                ans[n-2] = 1
                ans[n] = 3
                st.remove(1)
                st.remove(3)
                st.remove(4)
            else:
                ans[n-3] = x-2
                ans[n-2] = x+1
                ans[n] = x-1
                st.remove(x-2)
                st.remove(x+1)
                st.remove(x-1)
            for i in range(2*n-1):
                if ans[i] is None:
                    ans[i] = st.pop()
            for v in ans:
                print(v)

if __name__ == "__main__":
    main()

Solution (Python):
n, x = map(int, input().split())
if 1 < x < 2 * n - 1:
    print("Yes")
    ans = [0] * (2 * n - 1)
    use = [0] * (2 * n - 1)
    if n == 2:
        ans = [i for i in range(1, 4)]
    else:
        if not x == 2 * n - 2:
            ans[n - 1], ans[n] = x - 1, x
            ans[n - 2], ans[n + 1] = x + 1, x + 2
            for i in range(4):
                use[x - 2 + i] = 1
        else:
            ans[n - 1], ans[n] = x + 1, x
            ans[n - 2], ans[n + 1] = x - 1, x - 2
            for i in range(4):
                use[x - 3 + i] = 1
        i = 0
        for j in range(2 * n - 1):
            if ans[j] == 0:
                while True:
                    if use[i] == 0:
                        use[i] = 1
                        break
                    i += 1
                ans[j] = i + 1
    for i in ans:
        print(i)
else:
    print("No")

Solution (Python):
n, x = (int(x) for x in 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()

if x == 2:
    y = [3, 1, 2, 4]
else:
    y = [x - 1, x + 1, x, x - 2]

ANS = []
i = 1
while i < 2 * n:
    if len(ANS) == 2 * n - 1:
        break
    if i in y:
        i += 4
    if len(ANS) == n - 3:
        ANS += y
        if len(ANS) == 2 * n - 1:
            break
    ANS.append(i)
    i += 1

print("Yes")
for ans in ANS:
    print(ans)

Solution (Python):
n, x = (int(x) for x in 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()

if x == 2:
    y = [3, 2, 1, 4]
else:
    y = [x - 1, x, x + 1, x - 2]

ANS = []
i = 1
while i < 2 * n:
    if len(ANS) == 2 * n - 1:
        break
    if i in y:
        i += 4
    if len(ANS) == n - 3:
        ANS += y
        if len(ANS) == 2 * n - 1:
            break
    ANS.append(i)
    i += 1

print("Yes")
for ans in ANS:
    print(ans)

Solution (Python):


























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

if x <= 1 or x >= 2 * n - 1:
    print("No")
    exit()
if n == 2:
    print("Yes")
    for i in range(3):
        print(i + 1)
    exit()

ans = [0] * (2 * n - 1)
used = [False] * (2 * n)

if x <= n:
    ans[n - 1] = x
    ans[n - 2] = x - 1
    ans[n] = x + 1
    ans[n - 3] = x + 2
    used[x] = True
    used[x - 1] = True
    used[x + 1] = True
    used[x + 2] = True
    num = 1
    for i in range(2 * n - 1):
        if ans[i] == 0:
            while used[num]:
                num += 1
            ans[i] = num
            num += 1
    print("Yes")
    print(*ans, sep="\n")
else:
    ans[n - 1] = x
    ans[n - 2] = x + 1
    ans[n] = x - 1
    ans[n - 3] = x - 2
    used[x] = True
    used[x + 1] = True
    used[x - 1] = True
    used[x - 2] = True
    num = 1
    for i in range(2 * n - 1):
        if ans[i] == 0:
            while used[num]:
                num += 1
            ans[i] = num
            num += 1
    print("Yes")
    print(*ans, sep="\n")

Solution (Python):
def main():
    N, X = list(map(int, input().split()))
    if X in [1, 2 * N - 1]:
        print('No')
        return
    
    if N == 2:
        ans = [1, 2, 3]
    else:
        target_list = [X + 2, X - 1, X, X + 1, X - 2]
        target_list = [n for n in target_list if 1 <= n <= 2 * N - 1]
        rest_list = [n for n in range(1, 2 * N) if n not in target_list]
        len_rest = len(rest_list)
        ans = rest_list[:len_rest//2] + target_list + rest_list[len_rest//2:]
    print('Yes')
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()

Solution (Python):
n,x=map(int,input().split())
if x==1 or x==2*n-1:
  print('No')
else:
  print('Yes')
  m=[x-1,x,x+1]
  i=1
  for _ in range(n-2):
    while i in m:
      i+=1
    print(i)
    i+=1
  for mi in m:
    print(mi)
  for _ in range(n-2):
    while i in m:
      i+=1
    print(i)
    i+=1

Solution (Python):
from collections import deque

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

if x == 1 or x == 2*N-1:
    print("No")
elif N == 2:
    print("Yes")
    print(1)
    print(2)
    print(3)
elif x == 2:
    print("Yes")
    q = deque([4, 1, 2, 3, 5])
    high = 6
    while len(q) < 2 * N - 1:
        q.append(high)
        high += 1
        q.appendleft(high)
        high += 1  
        
    print(*list(q), sep = '\n')
elif x == 2 * N - 2:
    print("Yes")
    q = deque([2*N-4, 2*N-1, 2*N-2, 2*N-3, 2*N-5])
    low = 2*N-6
    while len(q) < 2 * N - 1:
        q.append(low)
        low -= 1
        q.appendleft(low)
        low -= 1  
    
    print(*list(q), sep = '\n')
else:
    print("Yes")
    q = deque([x])
    low = 1
    high = 2 * N - 1
    while low <= x - 2 and high >= x + 2:
        q.append(low)
        low += 1
        q.appendleft(high)
        high -= 1
        q.appendleft(low)
        low += 1
        q.append(high)
        high -= 1
    while low <= x - 2:
        q.append(low)
        low += 1
        q.appendleft(low)
        low += 1
    while high >= x + 2:
        q.append(high)
        high -= 1
        q.appendleft(high)
        high -= 1
    
    if low == x - 1 and high == x + 1:
        q.appendleft(low)
        q.append(high)

    print(*list(q), sep = '\n')

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

print('Yes' if 1 < x < (2 * n - 1) else 'No')
if 1 < x < (2 * n - 1):
    cnt = [i for i in range(2, 2 * n - 1) if i != x]
    ans = cnt[n - 2:] + [1, x, 2 * n - 1] + cnt[:n - 2]
    print(*ans, sep='\n')

Solution (Python):
from collections import deque

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

print('Yes' if 1 < x < (2 * n - 1) else 'No')
if 1 < x < (2 * n - 1):
    ans = deque([1, x, 2 * n - 1])
    cnt = deque([i for i in range(2, 2 * n - 1) if i != x])
    for i in range(n - 2):
        ans.append(cnt.popleft())
        ans.appendleft(cnt.pop())
    print(*ans, sep='\n')

Solution (Python):
import bisect
import copy
import heapq
import statistics
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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(n+1):
        print(i+1)
elif x==2:
    cnt=5
    for i in range(2*n-1):
        if i<n-2 or n+1<i:
            print(cnt)
            cnt+=1
        else:
            if i==n-2:
                print(x+1)
            elif i==n-1:
                print(x)
            elif i==n:
                print(x-1)
            else:
                print(x+2)
else:
    lst=[0]*(2*n-1)
    cnt=1
    for i in range(2*n-1):
        if i<n-2 or n+1<i:
            if cnt<x-2 or x+1<cnt:
                lst[i]=cnt
            else:
                cnt=x+2
                lst[i]=cnt
            cnt+=1
        else:
            if i==n-2:
                lst[i]=x-1
            elif i==n-1:
                lst[i]=x
            elif i==n:
                lst[i]=x+1
            else:
                lst[i]=x-2
    for i in range(2*n-1):
        print(lst[i])

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache





MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1: arr.append([temp, 1])
  if arr==[]: arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b: a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N,x = IL()

if x==1 or x==2*N-1:
  print("No")
else:
  A = list(range(1,2*N))
  if x >= N:
    ans = A[:N-1]+A[x-1:]+A[N-1:x-1]
  else:
    ans = A[x:N]+A[:x]+A[N:]
  print("Yes")
  print(*ans,sep="\n")

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, x = map(int, readline().split())
    ans = [0] * (2 * n - 1)

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

    for i in range(1, n + 1):
        if i % 2 == 1:
            ans[i - 1] = (x - 1 + abs(n - i)) % (2 * n - 1) + 1
        else:
            ans[i - 1] = (x - 1 - abs(n - i)) % (2 * n - 1) + 1
    ans[n] = x

    for i in range(n + 1, 2 * n):
        if i % 2 == 0:
            ans[i - 1] = (x - 1 + abs(n - i)) % (2 * n - 1) + 1
        else:
            ans[i - 1] = (x - 1 - abs(n - i)) % (2 * n - 1) + 1
    
    print("Yes")
    print(*ans, sep="\n")


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n, x = map(int, input().split())
if x==1 or x==2*n-1:
    print("No")
else:
    if n==2:
        ans = [1,2,3]
    else:
        s = set(range(1,2*n))
        ans = [None]*(2*n-1)
        if x>2:
            ans[n-2] = x-1
            ans[n-1] = x
            ans[n] = x+1
            ans[n+1] = x-2
        else:
            ans[n-2] = x+1
            ans[n-1] = x
            ans[n] = x-1
            ans[n+1] = x+2
        for i in range(n-2, n+2):
            s.remove(ans[i])
        for i in range(2*n-1):
            if ans[i] is None:
                ans[i] = s.pop()
    print("Yes")
    print("\n".join(map(str, ans)))

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


n, x = inm()


def solve():
    if x == 1 or x == 2 * n - 1:
        print("No")
        return
    a = [None] * (2 * n - 1)

    m = (2 * n - 1) // 2
    a[m] = x
    a[m - 1] = x - 1
    a[m + 1] = x + 1
    vals = [x - 1, x, x + 1]
    if m + 2 < 2 * n - 1 and x - 2 >= 1:
        a[m + 2] = x - 2
        vals.append(x - 2)
    if m - 2 >= 0 and x + 2 <= 2 * n - 1:
        a[m - 2] = x + 2
        vals.append(x + 2)
    y = 1
    for i in range(2 * n - 1):
        if a[i] is not None:
            continue
        while y in vals:
            y += 1
        a[i] = y
        y += 1

    print("Yes")
    print(*a, sep="\n")


solve()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


n, x = inm()


def solve():
    if x == 1 or x == 2 * n - 1:
        print("No")
        return
    a = [None] * (2 * n - 1)

    m = (2 * n - 1) // 2
    a[m] = x
    a[m - 1] = x - 1
    a[m + 1] = x + 1
    y = 1
    for i in range(2 * n - 1):
        if i in [m - 1, m, m + 1]:
            continue
        if y in [x - 1, x, x + 1]:
            y = x + 2
        a[i] = y
        y += 1

    print("Yes")
    print(*a, sep="\n")


solve()

Solution (Python):
n, x = map(int, input().split())
ans = [None]*(2*n-1)
if x == 2*n-1 or x == 1:
    print("No")

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

    else:
        ans[n-1] = x
        ans[n] = x-1
        ans[n+1] = x+2
        ans[n-2] = x+1
        num = 1
        for i in range(2*n-1):
            if x-1 <= num <= x+2:
                num = x+3
            if n-2 <= i <= n+1:
                continue
            ans[i] = num
            num += 1
    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()
print("Yes")
if n==2:print(*[1,2,3],sep="\n")
else:
 l=list(range(1,2*n))
 if x==2:a=[3,2,1,4]
 else:a=[x-1,x,x+1,x-2]
 l=list(set(l)-set(a))
 m=len(l)//2
 b=l[:m]+a+l[m:]
 print(*b,sep="\n")