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):
import sys

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

N, n = map(int, read().split())

def main(N, n):
    if n in (1, 2 * N - 1):
        print('No')
        return
    if N == 2:
        A = [1, 2, 3]
        print('Yes')
        print(*A, sep='\n')
        return
    if n == 2:
        a, b, c, d = 3, 2, 1, 4
    else:
        a, b, c, d = n - 1, n, n + 1, n - 2
    nums = list(range(1, N + N))
    for x in (a, b, c, d):
        nums.remove(x)
    k = len(nums) // 2
    A = nums[:k] + [a, b, c, d] + nums[k:]
    print('Yes')
    print(*A, sep='\n')

main(N, 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:
  print('1\n2\n3')
  exit()
P=[0]*(2*N-1)
P[N-1]=X
P[N-2]=X-1
P[N]=X+1
P[N+1]=1
if X==2:
  P[N-2]=X+1
  P[N]=1
  P[N+1]=X+2
S=set(P)
Z=2
for i in range(2*N-1):
  if P[i]:
    continue
  while Z in S:
    Z+=1
  P[i]=Z
  S.add(Z)
  Z+=1
print(*P,sep='\n')

Solution (Python):
def solve(n, x):
    m = 2 * n - 1
    if x == 1 or x == m:
        print('No')
        return
    if x <= n:
        tmp = [1] + list(range(x, m + 1)) + list(range(2, x))
    else:
        tmp = [m] + list(range(x, 0, -1)) + list(range(x + 1, m))
    ans = list(reversed(tmp[0::2])) + tmp[1::2]
    print('Yes')
    print('\n'.join(map(str, ans)))


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

Solution (Python):
def solve(n, x):
    m = 2 * n - 1

    if x == 1 or x == m:
        print('No')
        return
    if x == n:
        print('Yes')
        print('\n'.join(map(str, range(1, m + 1))))
        return
    if x < n:
        tmp = [1] + list(range(x, m + 1)) + list(range(2, x))
    else:
        tmp = [m] + list(range(x, 0, -1)) + list(range(x + 1, m))
    ans = list(reversed(tmp[0::2])) + tmp[1::2]
    print('Yes')
    print('\n'.join(map(str, ans)))


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

Solution (Python):








import sys
readline = sys.stdin.readline

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

if x == 1 or x == 2 * N - 1:
  print("No")
  exit(0)
elif x == N:
  A = [i + 1 for i in range(2 * N - 1)]
elif x < N:
  A = [0 for i in range(2 * N - 1)]
  A[N - 1] = x
  A[N - 2] = 1
  ind = 0
  for num in range(2,2 * N):
    if num in (1,x):
      continue
    if A[ind] != 0:
      ind += 2
    A[ind] = num
    ind += 1
elif x > N:
  A = [0 for i in range(2 * N - 1)]
  A[N - 1] = x
  A[N] = 2 * N - 1
  ind = 0
  for num in range(1,2 * N):
    if num in (x,2 * N - 1):
      continue
    if A[ind] != 0:
      ind += 2
    A[ind] = num
    ind += 1

print("Yes")
for a in A:
  print(a)

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')
    for x in range(1,4):
        print(x)
else:
    print('Yes')
    if x==2:
        num = deque(list(range(5,2*N)))
        que = deque([3,2,1,4])
    else:
        num = deque(list(range(1,x-2))+list(range(x+2,2*N)))
        que = deque([x-1,x,x+1,x-2])
    for i in range(2*N-1):
        if N-2<=i<=N+1:
            print(que.popleft())
        else:
            print(num.popleft())

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N,x = map(int,input().split())
    if N == 2:
        if x == 2:
            print('Yes')
            print('\n'.join(map(str,(1,2,3))))
        else:
            print('No')
        return
    if x == 1 or x == 2*N - 1:
        print('No')
        return

    ans = [-1] * (2*N - 1)
    used = [False] * (2*N)
    if x == 2:
        ans[N - 3] = x + 2
        ans[N - 2] = x - 1
        ans[N - 1] = x
        ans[N] = x + 1
        used[x - 1] = True
        used[x] = True
        used[x + 1] = True
        used[x + 2] = True
        now = 1
        for i in range(2*N - 1):
            if ans[i] >= 0:
                continue
            while used[now]:
                now += 1
            ans[i] = now
            used[now] = True
    else:
        ans[N - 3] = x - 2
        ans[N - 2] = x + 1
        ans[N - 1] = x
        ans[N] = x - 1
        used[x - 1] = True
        used[x] = True
        used[x + 1] = True
        used[x - 2] = True
        now = 1
        for i in range(2*N - 1):
            if ans[i] >= 0:
                continue
            while used[now]:
                now += 1
            ans[i] = now
            used[now] = True
    print('Yes')
    print('\n'.join(map(str,ans)))
if __name__ == '__main__':
    main()

Solution (Python):
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

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

    ans = [0] * (2*N-1)
    ans[N-2] = x-1
    ans[N-1] = x
    ans[N] = x+1

    j = N+1
    for i in range(1,2*N):
        if i < x-1 or i > x+1:
            ans[j] = i
            j += 1
            if j >= 2 * N - 1:
                j = 0
    print('Yes')
    print(*ans,sep='\n')


if __name__ == '__main__':
    main()

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

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

if(n==2):
    print('Yes')
    print('\n'.join(map(str,[1,2,3])))
    exit()

m = 2*n-1
ans = list(range(1,m+1))
ans = ans + ans
center = m//2
if(x-1 < center):
    ans = ans[m+x-1-center : m+m+x-1-center]
else:
    ans = ans[x-1-center : m+x-1-center]

if not ((x==2)|(x==m-1)):
    ans[center-2],ans[center+2] = ans[center+2],ans[center-2]

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

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

if x in [1, 2*N-1]:
  print('No')
else:
  print('Yes')
  if N == 2:
    print(*range(1, 4), sep='\n')
  else:
    ans = [0] * (2*N - 1)
    s = set(range(1, 2*N))
    if x >= N:
      ans[N-2] = x - 1; s.discard(x-1)
      ans[N-1] = x; s.discard(x)
      ans[N] = x + 1; s.discard(x+1)
      ans[N+1] = x - 2; s.discard(x-2)
    else:
      ans[N-2] = x + 1; s.discard(x+1)
      ans[N-1] = x; s.discard(x)
      ans[N] = x - 1; s.discard(x-1)
      ans[N+1] = x + 2; s.discard(x+2)
    for i in range(2*N-1):
      if ans[i]:
        continue
      ans[i] = s.pop()
    print(*ans, sep='\n')

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

Solution (Python):
def main():

    def calc(lst):
        now = lst
        while len(now) > 1:
            tmp = []
            for i in range(len(now) - 2):
                ABC = [now[i], now[i + 1], now[i + 2]]
                ABC.sort()
                tmp.append(ABC[1])
            now = tmp
        return now[0]

    N, x = map(int, input().split())
    if x == 1 or x == 2 * N - 1:
        print ('No')
        return 0
    print ('Yes')
    ans = [(1 + i) for i in range(2 * N - 1)]
    if x < N:
        tmp = N - x + 1
        for i in range((tmp + 1) // 2):
            ans[N - i - 1], ans[N - tmp + i - 1] = ans[N - tmp + i - 1], ans[N - i -1]
    else:
        tmp = x - N + 1
        for i in range((tmp + 1) // 2):
            ans[N + i - 1], ans[N + tmp - i - 1] = ans[N + tmp - i - 1], ans[N + i - 1]
    print (*ans, sep = '\n')
    

if __name__ == '__main__':
    main()

Solution (Python):
from itertools import permutations
n, x = map(int, input().split())
if x == 1 or x == 2 * n - 1:
    print('No')
else:
    print('Yes')
    if n == 2:
        ans = [1, 2, 3]
    else:
        if x == 2:
            ans = [i for i in range(1, x - 1)] \
                  + [i for i in range(x + 3, 2 * n)]
            ans = ans[:n-3] + [x+2, x-1, x, x+1] + ans[n-3:]
        else:
            ans = [i for i in range(1, x - 2)] \
                  + [i for i in range(x + 2, 2 * n)]
            ans = ans[:n-3] + [x-2, x+1, x, x-1] + ans[n-3:]

    for i in range(2 * n - 1):
        print(ans[i])

Solution (Python):
n,x = map(int, input().split())
if 1 < x < (2*n - 1):
    print("Yes")
    if n == 2:
        for i in range(3):
            print(i+1)
        exit()
    if x != 2:
        ans = [-1 for i in range(2*n-1)]
        k = (n*2-1) //2
        ans[k-1] = x-1
        ans[k] = x
        ans[k+1] = x+1
        ans[k+2] = x-2
        used = set([x-1,x,x+1,x-2])
        insert = iter([i+1 for i in range(n*2-1) if (i+1) not in used])
        for i in range(2*n-1):
            if ans[i] == -1:
                ans[i] = insert.__next__()
        for i in range(n*2-1):
            print(ans[i])
    else:
        ans = [-1 for i in range(2*n-1)]
        k = (n*2-1) // 2
        ans[k-1] = x+2
        ans[k] = x
        ans[k+1] = x-1
        ans[k+2] = x+1
        used = set([x+1,x,x+2,x-1])
        insert = iter([i+1 for i in range(n*2-1) if (i+1) not in used])
        for i in range(2*n-1):
            if ans[i] == -1:
                ans[i] = insert.__next__()
        for i in range(n*2-1):
            print(ans[i])
else:
    print("No")

Solution (Python):
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    N, X = read_values()
    
    if X in (1, 2 * N - 1):
        print("No")
        return
    
    print("Yes")

    F = [i for i in range(2 * N - 1, 0, -1) if i != X]
    for f in F[N - 1:]:
        print(f)
    print(X)
    for f in F[:N - 1]:
        print(f)


if __name__ == "__main__":
    main()

Solution (Python):
import math
import fractions



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 ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ZipArray(a):
    aa = [[a[i],i]for i in range(n)]

    aa.sort(key = lambda x : x[0])
    for i in range(n):
        aa[i][0]=i+1
    aa.sort(key = lambda x : x[1])
    b=[aa[i][0] for i in range(len(a))]
    return b

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans

def Zeros(a,b):
    if(b<=-1):
        return [0 for i in range(a)]
    else:
        return [[0 for i in range(b)] for i in range(a)]

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
            
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  
factinv = [1, 1]  
inv = [0, 1]  

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''










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

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

if(x==n):
    print("Yes")
    for i in range(2*n-1):
        print(i+1)
    exit()
elif(x<n):
    nums = [-1 for i in range(2*n-1)]
    used = [0 for i in range(2*n)]
    used[0]=1
    nums[n-1] = x
    nums[n] = x-1
    nums[n-2] = x+1
    nums[n-3] = x+2
    used[x] = used[x-1] = used[x+1] = used[x+2] = 1
    
    now = 0
    pos = 0
    while(pos<2*n-1):
        if(used[now]==1):
            now+=1
            continue
        if(nums[pos]!=-1):
            pos+=1
            continue
        nums[pos] = now
        used[now] = 1
        pos+=1
        now+=1
            
else:
    nums = [-1 for i in range(2*n-1)]
    used = [0 for i in range(2*n)]
    used[0]=1
    nums[n-1] = x
    nums[n] = x+1
    nums[n-2] = x-1
    nums[n-3] = x-2
    used[x] = used[x+1] = used[x-1] = used[x-2] = 1
    
    now = 0
    pos = 0
    while(pos<2*n-1):
        if(used[now]==1):
            now+=1
            continue
        if(nums[pos]!=-1):
            pos+=1
            continue
        nums[pos] = now
        used[now] = 1
        pos+=1
        now+=1
            

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

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

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

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

if N == 1:
    print("Yes")
    print(1)
    exit()


if X == 1 or X == U:
    print("No")
    exit()

ans = [-1] * U
ans[N - 1] = X

big = U - X
small = X - 1

Xsmall = X - 1
Xbig = X + 1

if small < big:
    for i in range(small):
        ans[N + i] = Xsmall
        Xsmall -= 1
    for i in range(U):
        if ans[i] == -1:
            ans[i] = Xbig
            Xbig += 1
else:
    for i in range(big):
        ans[N + i] = Xbig
        Xbig += 1
    for i in range(U):
        if ans[i] == -1:
            ans[i] = Xsmall
            Xsmall -= 1

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

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

if n == 2:
    if x == 2:
        print('Yes')
        print('\n'.join(['1','2','3']))
    else:
        print('No')
else:
    if x == 1 or x == 2*n - 1:
        print('No')
    else:
        print('Yes')
        if x == 2:
            ans = list(range(3,2*n-2))
            ans = ans[:n-3] + [2*n - 1,1,2,2*n - 2] + ans[n-3:]
        else:
            ans = list(range(2*n - 1))
            ans = ans[3:x] + ans[x+1:2*n - 1]
            ans = ans[:n-3] + [1,2*n - 1,x,2] + ans[n-3:]
        print('\n'.join(str(i) for i in ans))

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

Solution (Python):
from collections import deque
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")
else:
    M = 2*N-1
    if x == 1 or x ==M:
        print("No")
    else:
        print("Yes")

        ans = [0]*(M)
        num = deque(list(range(1,M+1)))
        if x == 2:
            ans[M//2] = x
            ans[M//2-1] = 1
            num.remove(x)
            num.remove(1)
            for i in range(M):
                if ans[i] == 0:
                    ans[i] = num.popleft()
        else:
            ans[M//2] = x
            ans[M//2-1] = x+1
            ans[M//2-2] = x-2
            ans[M//2+1] = x-1
            num.remove(x)
            num.remove(x+1)
            num.remove(x-2)
            num.remove(x-1)
            for i in range(M):
                if ans[i] == 0:
                    ans[i] = num.popleft()
    
        for i in range(M):
            print(ans[i])

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,X=MI()
    if(X==1 or X==2*N-1):
        if(N==1):
            print("Yes")
            print(1)
        else:
            print("No")
    else:
        if(N==2):
            if(X==2):
                print("Yes")
                print("1\n2\n3")
            else:
                print("No")
        else:
            ans = [-1]*(2*N-1)
            ans[N-2] = 1
            ans[N-1] = X
            ans[N] = 2*N-1
            used = set([X,1,2*N-1])
            now = 2
            for i in range(N+1,2*N-1):
                while(now in used):
                    now += 1
                ans[i] = now
                used.add(now)
            for i in range(N-2):
                while(now in used):
                    now += 1
                ans[i] = now
                used.add(now)
            print("Yes")
            
            print(*ans,sep="\n")
if __name__ == '__main__':
    main()

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')
else:
    if x==1 or x==2*N-1:
        print('No')
    elif x==2:
        print('Yes')
        S=[]
        T=[2*N-1,1,2,3,2*N-2]
        U=[]
        count=0
        for i in range(1,2*N):
            if (not i in T) and N-3>count:
                S.append(i)
                count+=1
                continue
            if (not i in T) and count>=N-3:
                U.append(i)
                continue
        ans=S+T+U
        for i in range(0,2*N-1):
            print(ans[i])
    elif x==2*N-2:
        print('Yes')
        S=[]
        T=[3,1,2*N-2,2*N-1,2]
        U=[]
        count=0
        for i in range(1,2*N):
            if (not i in T) and N-3>count:
                S.append(i)
                count+=1
                continue
            if (not i in T) and count>=N-3:
                U.append(i)
                continue
        ans=S+T+U
        for i in range(0,2*N-1):
            print(ans[i])
    else:
        print('Yes')
        S=[]
        T=[2*N-1,2,x,2*N-2,1]
        U=[]
        count=0
        for i in range(1,2*N):
            if (not i in T) and N-3>count:
                S.append(i)
                count+=1
                continue
            if (not i in T) and count>=N-3:
                U.append(i)
                continue
        ans=S+T+U
        for i in range(0,2*N-1):
            print(ans[i])

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

def test(a):
    while len(a) != 1:
        tmp = []
        for i in range(len(a) - 2):
            tmp.append(sorted([a[i], a[i + 1], a[i + 2]])[1])
        a = tmp[::1]
    return tmp[0]

def solve():
    n, x = LI()
    if 1 == x or 2 * n - 1 == x:
        print("No")
        return
    print("Yes")
    if x < n:
        for i in range(n, 0, -1):
            if i == x:
                continue
            print(i)
        print(x)
        for i in range(n + 1, 2 * n):
            print(i)
    elif x == n:
        for i in range(1, 2 * n):
            print(i)
    else:
        for i in range(1, n):
            print(i)
        print(x)
        for i in range(2 * n - 1, n - 1, -1):
            if i == x:
                continue
            print(i)




if __name__ == '__main__':
    solve()

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(*range(1, 2 * N), sep="\n")
    else:
        if x == 2:
            not_use = list(range(5, 2*N))
            ans = not_use[::2]
            ans += [3,2,1,4]
            ans += not_use[1::2]
        else:
            not_use = list(range(1, x-2)) + list(range(x+2, 2*N))
            ans = not_use[::2]
            ans += [x-1,x,x+1,x-2]
            ans += not_use[1::2]
        print(*ans, sep="\n")

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:
        li = [x + 1, x, x - 1, x + 2]
    else:
        li = [x - 1, x, x + 1, x - 2]

    others = [e for e in range(1, 2 * n) if e not in li]
    ans = others[:n-2] + li + others[n-2:]

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

Solution (Python):
n,x = [int(i) for i in input().split()]
a = [i for i in range(1,2*n)]

def swap(a,i,j):
    b = a[i]
    a[i] = a[j]
    a[j] = b

if x==1 or x==2*n -1:
    print("No")
else:
    print("Yes")
    if x==n:
        pass
    elif x>n:
        swap(a,n-1,x-1)
        swap(a,n,2*n-2)
        swap(a,n+1,0)
    else:
        swap(a,n-1,x-1)
        swap(a,n-2,0)
        swap(a,n-3,2*n-2)
    for i in a:
        print(i)

Solution (Python):
import sys
input = sys.stdin.buffer.readline

def main():
    N,x = map(int,input().split())
    
    if N == 2:
        if x == 2:
            print("Yes")
            print(1)
            print(2)
            print(3)
        else:
            print("No")
    else:
        if x == 1 or x == 2*N-1:
            print("No")
        elif x == 2*N-2:
            print("Yes")
            ans = [i+1 for i in range(2*N-1)]
            ans[N-1],ans[2*N-2] = ans[2*N-2],ans[N-1]
            ans[N-2],ans[2*N-3] = ans[2*N-3],ans[N-2]
            for num in ans:
                print(num)
        else:
            print("Yes")
            b = [True for _ in range(2*N-1)]
            use = [x+1,x-1,x,x+2]
            ans = []
            for num in use:
                b[num-1] = False
            p = 0
            while len(ans)<N-3:
                if b[p]:
                    ans.append(p+1)
                    b[p] = False
                p += 1
            ans += use
            while len(ans)<2*N-1:
                if b[p]:
                    ans.append(p+1)
                    b[p] = False
                p += 1
            for num in ans:
                print(num)
    
if __name__ == "__main__":
    main()

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:
    lst=[0 for i in range(2*N-1)]
    nlst=set([i for i in range(1,2*N)])
    if x>=N:
        lst[N-1]=x
        lst[N]=x+1
        lst[N+1]=x-1
        lst[N-2]=x-2
        nlst.remove(x)
        nlst.remove(x+1)
        nlst.remove(x-1)
        nlst.remove(x-2)
    else:
        lst[N-1]=x
        lst[N]=x-1
        lst[N+1]=x+1
        lst[N-2]=x+2
        nlst.remove(x)
        nlst.remove(x-1)
        nlst.remove(x+1)
        nlst.remove(x+2)

    idxlst=set([i for i in range(2*N-1)])
    idxlst.remove(N-2)
    idxlst.remove(N-1)
    idxlst.remove(N)
    idxlst.remove(N+1)

    nlst=list(nlst)
    idxlst=list(idxlst)
    for n,i in zip(nlst,idxlst):
        lst[i]=n
    print("Yes")
    for i in lst:
        print(i)

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

n = 2 * N - 1
if x == 1 or x == n:
    print('No')
    exit()
elif N == 2:
    print('Yes')
    print('\n'.join(map(str, [1, 2, 3])))
    exit()

n = n // 2 + 1
N *= 2
answer = [0] * N

if x == N - 2:
    answer[n] = x
    answer[n + 1] = x + 1
    answer[n + 2] = x - 1
    answer[n - 1] = x - 2

    numbers = list(range(1, x - 2)) + list(range(x + 2, N))
else:
    answer[n] = x
    answer[n + 1] = x - 1
    answer[n + 2] = x + 2
    answer[n - 1] = x + 1

    numbers = list(range(1, x - 1)) + list(range(x + 3, N))

for i in range(1, N):
    if answer[i] == 0:
        answer[i] = numbers.pop()

print('Yes')
print('\n'.join(map(str, answer[1:])))

Solution (Python):
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,x = inm()
if x in [1,2*n-1]:
    print('No')
    exit()
print('Yes')
if n==2:
    print(1)
    print(2)
    print(3)
    exit()

a = [0]*(2*n)
for i in range(1,2*n):
    j = i+(x-n)
    if j<1:
        j += 2*n-1
    elif j>2*n-1:
        j -= 2*n-1
    a[i] = j
a[n-1] = x+1
a[n+1] = x-1
for i in range(1,2*n):
    print(a[i])

Solution (Python):
N, x = map(int, input().split())
if x == 1 or x == 2*N-1:
    print('No')
    exit()
print('Yes')
ans = None
if N == 2:
    ans = [1, 2, 3]
elif x+2 <= 2*N-1:
    ans = list(range(1, x-1)) + list(range(x+3, 2*N))
    ans = ans[:N-3] + [x+2, x-1, x, x+1] + ans[N-3:]
else:
    ans = list(range(1, x-2)) + list(range(x+2, 2*N))
    ans = ans[:N-3] + [x-2, x+1, x, x-1] + ans[N-3:]
for i in ans:
    print(i)

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

Solution (Python):
N, x = map(int, input().split())
if 2*N-x>2 and x>2 and N>2:
  print('Yes')
  ans = [x-2,x+1,x,x-1,x+2]
  ls = []
  for i in range(1,2*N):
    if i in ans:
      continue
    ls += [i]
  ans = ls[:len(ls)//2]+ans+ls[len(ls)//2:]
  print('\n'.join(map(str, ans)))
  
elif 2*N-x>2 and x>1 and N>2:
  print('Yes')
  ans = [x+1,x,x-1,x+2]
  ls = []
  for i in range(1,2*N):
    if i in ans:
      continue
    ls += [i]
  ans = ls[:len(ls)//2+1]+ans+ls[len(ls)//2+1:]
  print('\n'.join(map(str, ans)))
elif 2*N-x>1 and x>2 and N>2:
  print('Yes')
  ans = [x-1,x,x+1,x-2]
  ls = []
  for i in range(1,2*N):
    if i in ans:
      continue
    ls += [i]
  ans = ls[:len(ls)//2+1]+ans+ls[len(ls)//2+1:]
  print('\n'.join(map(str, ans)))
elif N==2:
  if x==2:
    print('Yes')
    print(1,2,3,sep='\n')
  else:
    print('No')
else:
  print('No')

Solution (Python):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



def pprint(ans):
    for a in ans:
        print(a)

N,x = LI()

if N == 2:
    if x == 2:
        print('Yes')
        pprint([1,2,3])
    else:
        print('No')
else:
    if x in [1,2*N-1]:
        print('No')
    elif x == 2*N-2:
        ans = [0]*(2*N-1)
        ans[N-3],ans[N-2],ans[N-1],ans[N] = 2*N-4,2*N-1,2*N-2,2*N-3
        left = list(range(1,2*N-4))
        for i in range(2*N-1):
            if not ans[i]:
                ans[i] = left.pop()
        print('Yes')
        pprint(ans)
    else:
        ans = [0]*(2*N-1)
        ans[N-3],ans[N-2],ans[N-1],ans[N] = x+1,x-1,x,x+2
        left = list(range(1,x-1)) + list(range(x+3,2*N))
        for i in range(2*N-1):
            if not ans[i]:
                ans[i] = left.pop()
        print('Yes')
        pprint(ans)