CodeEff/ECCO huggingface dataset:
# Original solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()

l = 0
r = n

while l < r:
    m = (l + r) // 2
    if a[m] >= k:
        r = m
        continue
    dp = [[0 for _ in range(k)] for _ in range(n)]
    dp[0][0] = 1
    t = 1
    check = 0
    for i in range(n):
        if i == m:
            continue
        for j in range(k - a[i]):
            if dp[t - 1][j] == 1:
                dp[t][j] = 1
                temp = j + a[i]
                if k - a[m] <= temp < k:
                    check = 1
                    break
                elif temp < k - a[m]:
                    dp[t][temp] = 1
        if check == 1:
            break
        t += 1
    if check == 0:
        l = m + 1
    else:
        r = m

print(l)

# Optimized solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()

l = 0
r = n

while l < r:
    m = (l + r) // 2
    if a[m] >= k:
        r = m
        continue
    dp = set()
    dp.add(0)
    check = 0
    for i in range(n):
        next = set()
        if i == m:
            continue
        for x in dp:
            temp = x + a[i]
            if k - a[m] <= temp < k:
                check = 1
                break
            elif temp < k - a[m]:
                next.add(temp)
        if check == 1:
            break
        else:
            dp = dp | next
    if check == 0:
        l = m + 1
    else:
        r = m

print(l)
# Original solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()

l = 0
r = n

while l < r:
    m = (l + r) // 2
    if a[m] >= k:
        r = m
        continue
    dp = [set() for _ in range(n + 1)]
    dp[0].add(0)
    check = 0
    for i in range(n):
        if i == m:
            dp[i + 1] = dp[i]
            continue
        for x in dp[i]:
            dp[i + 1].add(x)
            temp = x + a[i]
            if k - a[m] <= temp < k:
                check = 1
                break
            elif temp < k - a[m]:
                dp[i + 1].add(temp)
        if check == 1:
            break
    if check == 0:
        l = m + 1
    else:
        r = m

print(l)

# Optimized solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort(reverse=True)

temp = 0
ans = 0

for x in a:
    if temp + x < k:
        temp += x
        ans += 1
    else:
        ans = 0

print(ans)
# Original solution
from itertools import accumulate
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort()
acc = list(accumulate(a))

def maxsum(ls,k):
  l = len(ls)
  if l==0:
    return 0
  dp = [0 for i in range(l+1)]
  dp[0] = 1
  for i in range(1,l+1):
    dp[i] = dp[i-1]|(dp[i-1]<<ls[i-1])
  for b in range(k-1,-1,-1):
    if dp[l] & 1<<b:
      return b

for i in range(n):
  if a[i]>=k:
    a = a[:i]
    break
n = len(a)
if acc[n-1] < k:
  print(n)
  exit()
sepa=[]
for i in range(n-1):
  if acc[i]<a[i+1]:
    sepa.append(i)
m=len(sepa)
if m==0:
  print((0))
  exit()
lf = 0
r = m-1
while lf<r:
  mid = (lf+r)//2
  x=sepa[mid]
  sumx = acc[x]
  if maxsum(a[x+1:],k)+sumx >= k:
    r = mid
  else:
    lf = mid+1
if r==0:
  t=sepa[0]
  if maxsum(a[t+1:],k)+acc[t]>=k:
    print((0))
  else:
    print((sepa[r]+1))
else:
  print((sepa[r]+1))

# Optimized solution
from itertools import accumulate
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort()
acc = list(accumulate(a))

def maxsum(ls,k):
  l = len(ls)
  if l==0:
    return 0
  dp = [0 for i in range(l+1)]
  dp[0] = 1
  for i in range(1,l+1):
    dp[i] = (dp[i-1]|(dp[i-1]<<ls[i-1]))&((1<<k)-1)
  for b in range(k-1,-1,-1):
    if dp[l] & 1<<b:
      return b

for i in range(n):
  if a[i]>=k:
    a = a[:i]
    break
n = len(a)
if acc[n-1] < k:
  print(n)
  exit()
sepa=[]
for i in range(n-1):
  if acc[i]<a[i+1]:
    sepa.append(i)
m=len(sepa)
if m==0:
  print((0))
  exit()
lf = 0
r = m-1
while lf<r:
  mid = (lf+r)//2
  x=sepa[mid]
  sumx = acc[x]
  if maxsum(a[x+1:],k)+sumx >= k:
    r = mid
  else:
    lf = mid+1
if r==0:
  t=sepa[0]
  if maxsum(a[t+1:],k)+acc[t]>=k:
    print((0))
  else:
    print((sepa[r]+1))
else:
  print((sepa[r]+1))
# Original solution
import sys
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
#A = [i for i in range(1,2)] + [i for i in range(2,1001)] * 4
A.sort()

DP = [0 for k in range(K+1)] #和がkとなる部分集合の数
DP[0] = 1
for a in A:
  for k in range(K-a,-1,-1):
    DP[k+a] += DP[k]

"""
for k in range(1,2*K+1): #累積和へ変換
  DP[k] += DP[k-1]
print(DP)
"""
"""
if sum(DP[0:K]) == 2**N:
  print(N)
  sys.exit()
"""
#print(DP)  
ans = 0
DP_rev = [0 for _ in range(K)] #戻すDP!!!
flag = True
for a in A:
  if not flag: break
  for i in range(K):
    DP_rev[i] = DP[i] 
    if i-a >= 0:
      DP_rev[i] -= DP_rev[i-a]
    if i >= K-a and DP_rev[i] > 0:
      flag = False
      break
  if flag:
    ans += 1
  #print(a, DP_rev)
    
print(ans)
  
  
  
  


# Optimized solution
import sys
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
#A = [i for i in range(1,2)] + [i for i in range(2,1001)] * 4
A.sort()

DP = [0 for k in range(K+1)] #和がkとなる部分集合の数
DP[0] = 1
for a in A:
  for k in range(K-a,-1,-1):
    DP[k+a] += DP[k]

"""
for k in range(1,2*K+1): #累積和へ変換
  DP[k] += DP[k-1]
print(DP)
"""
"""
if sum(DP[0:K]) == 2**N:
  print(N)
  sys.exit()
"""
#print(DP)  


def det(t):
  a = A[t]
  if a >= K:
    return False
  DP_rev = [0 for _ in range(K)] #戻すDP!!!
  ans = True
  for i in range(K):
    DP_rev[i] = DP[i] 
    if i-a >= 0:
      DP_rev[i] -= DP_rev[i-a]
    if i >= K-a and DP_rev[i] > 0:
      ans = False
      break
  del DP_rev
  return ans

lt = 0
rt = N-1
if not det(lt):
  print((0))
  sys.exit()
if det(rt):
  print((rt+1))
  sys.exit()

while rt - lt > 1:
  ct = (lt + rt) // 2
  if det(ct):
    lt = ct
  else:
    rt = ct
print(rt)
# Original solution
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, K: int, a: "List[int]"):
    a.sort()

    if a[0] >= K:
        print((0))
        return

    a = [x for x in a if x < K]
    N = len(a)

    ng = -1
    ok = N
    while abs(ok - ng) > 1:
        j = (ok + ng) // 2
        # print(A)
        DP = [[False]*K for _ in range(N)]
        DP[0][a[0 if j != 0 else 1]] = True
        for i in range(1, N):
            for k in range(K):
                DP[i][k] = DP[i-1][k] or DP[i][k]
                if i != j and k < K-a[i]:
                    DP[i][k+a[i]] = DP[i-1][k]
        if any(DP[-1][max(K-a[j], 0):]):
            ok = j
        else:
            ng = j
    print(ok)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, a)


if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, K: int, a: "List[int]"):
    a.sort()

    if a[0] >= K:
        print((0))
        return

    a = [x for x in a if x < K]
    N = len(a)

    ng = -1
    ok = N
    while abs(ok - ng) > 1:
        j = (ok + ng) // 2
        # print(A)
        DP = [False]*K
        DP[a[not j]] = True
        for i in range(1, N):
            if i == j:
                continue
            for k in range(K-a[i]-1, -1, -1):
                DP[k+a[i]] = DP[k] or DP[k+a[i]]
        if any(DP[max(K-a[j], 0):]):
            ok = j
        else:
            ng = j
    print(ok)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, a)


if __name__ == '__main__':
    main()
# Original solution
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)
MOD = 10 ** 30 + 7

N, M = list(map(int, input().split()))
s = input()

p27 = [1 for i in range(500000)]
for i in range(1, 500000):
    p27[i] = p27[i - 1] * 27
    p27[i] %= MOD

m = {}
P = (ord(s[0]) - ord('a') + 1)
l = 0
r = 0
for loop in range(M):
    S = input()
    if S == 'L++':
        P -= (ord(s[l]) - ord('a') + 1) * p27[r - l]
        P %= MOD
        l += 1
    elif S == 'L--':
        l -= 1
        P += (ord(s[l]) - ord('a') + 1) * p27[r - l]
        P %= MOD
    elif S == 'R++':
        r += 1
        P *= 27
        P += (ord(s[r]) - ord('a') + 1)
        P %= MOD
    elif S == 'R--':
        P -= (ord(s[r]) - ord('a') + 1)
        P %= MOD
        for i in range(27):
            if (P + MOD * i) % 27 == 0:
                P = (P + MOD * i) / 27
                break
        r -= 1
    #print s[l:r + 1], P
    m[P] = 1
print(len(m))


# Optimized solution
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)
MOD = 10 ** 30 + 7

N, M = list(map(int, input().split()))
s = input()

p27 = [1 for i in range(500000)]
for i in range(1, 500000):
    p27[i] = p27[i - 1] * 27
    p27[i] %= MOD

m = {}
P = (ord(s[0]) - ord('a') + 1)
l = 0
r = 0
for loop in range(M):
    S = input()
    if S == 'L++':
        P -= (ord(s[l]) - ord('a') + 1) * p27[r - l]
        P %= MOD
        l += 1
    elif S == 'L--':
        l -= 1
        P += (ord(s[l]) - ord('a') + 1) * p27[r - l]
        P %= MOD
    elif S == 'R++':
        r += 1
        P *= 27
        P += (ord(s[r]) - ord('a') + 1)
        P %= MOD
    elif S == 'R--':
        P -= (ord(s[r]) - ord('a') + 1)
        P %= MOD
        for i in range(27):
            if (P + MOD * i) % 27 == 0:
                P = (P + MOD * i) / 27
                break
        r -= 1
    m[P] = 1
print(len(m))
# Original solution
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))

n,d=nii()
print(((n+d*2+1-1)//(d*2+1)))

# Optimized solution
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))

n,d=nii()
num=d*2+1
print(((n+num-1)//num))
# Original solution
import math
n,d=list(map(int,input().split()))
a=n/(2*d+1)
print((math.ceil(a)))

# Optimized solution
n,d=list(map(int,input().split()))
a=n/(2*d+1)
import math
b=math.ceil(a)
print(b)
# Original solution
n,d=list(map(int,input().split()))
p=0
while n>0:
  n-=(d*2+1)
  p+=1
print((str(p)))

# Optimized solution
def people(n):
  p=0
  while n>0:
    n-=(d*2+1)
    p+=1
  return p

def main():
  print((people(n)))
  
if __name__=='__main__':
  n,d=list(map(int,input().split()))
  main()
# Original solution
a,b=list(map(int,input().split()))
print(((a-1)//(2*b+1)+1))

# Optimized solution
n,d=list(map(int,input().split()))
d=2*d+1
print((0--n//d))
# Original solution
# 2019-11-15 14:12:24(JST)
import sys
# import collections
import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, d = [int(x) for x in sys.stdin.readline().split()]
    ran = 1 + d * 2
    number = math.ceil(n / ran)
    print(number)

if __name__ == "__main__":
    main()


# Optimized solution
import sys

n, d = list(map(int, sys.stdin.readline().split()))

def main():
    c = 2*d + 1
    return (n + c - 1) // c

if __name__ == '__main__':
    ans = main()
    print(ans)
# Original solution
N, D = list(map(int, input().split()))
print(((N + 2 * D)//(2 *D + 1)))

# Optimized solution
N, D = list(map(int, input().split()))

tmp = 2 * D + 1

print(((N + tmp - 1) // tmp))
# Original solution
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(eval(input()))
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print((k.join(list(map(str, lst)))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N, D = MI()
    ans = 0
    while N > 0:
        N -= 1 + 2 * D
        ans += 1
    print(ans)

if __name__ == '__main__':
    solve()



# Optimized solution
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def MI1(): return list(map(int1, input().split()))
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(eval(input()))
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print((k.join(list(map(str, lst)))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N, D = MI()
    print(((N+2*D)//(1+2*D)))

if __name__ == '__main__':
    solve()
# Original solution
import math
n,d=list(map(int,input().split()))
print((math.ceil(n/(d*2+1))))

# Optimized solution
n,d=list(map(int,input().split()))
if n%(d*2+1):
    print((n//(d*2+1)+1))
else:
    print((n//(d*2+1)))
# Original solution
n, d = list(map(int, input().split()))
x = 2*d+1	#監視可能範囲
if n%x == 0:
	print((n//x))
else:
  print((n//x + 1))

# Optimized solution
n, d = list(map(int, input().split()))
dist = 2 * d + 1
if n%dist != 0:
    print((n//dist + 1))
else:
    print((n//dist))
# Original solution
n, d = list(map(int, input().split()))

ans = 0

n -= (d+1)  # 一人目の立つ場所
ans += 1
if n <= 0:
    print(ans)
    exit()
while True:
    if (n - d) <= 0:
        break
    else:
        n -= (2*d + 1)
        ans += 1
        if n <= 0:
            break

print(ans)


# Optimized solution
import math

N, D = list(map(int, input().split()))

print((math.ceil(N/(2*D+1))))
# Original solution
n,d=list(map(int,input().split()))
l=d+1
r=n-d
if l==r:
    print((1))
else:
    ans=1
    k=l
    while k<r:
        k+=2*d+1
        ans+=1
    print(ans)

# Optimized solution
n,d=list(map(int,input().split()))
print(((n+2*d)//(2*d+1)))
# Original solution
import math
n, d = list(map(int, input().split()))
cnt = 0

print((math.ceil(n/(2*d+1))))

# Optimized solution
import math
n, d = list(map(int, input().split()))

print((math.ceil(n/(2*d+1))))
# Original solution
n,d=list(map(int,input().split()))
print((n//(2*d+1)+(n%(2*d+1)>0)))

# Optimized solution
n,d=list(map(int,input().split()))
print((n//(d+d+1)+(n%(d+d+1)>0)))
# Original solution
from decimal import Decimal,ROUND_HALF_UP
n,d = list(map(int,input().split()))
x = (n+d*2)//(d*2+1)
print(x)

# Optimized solution
n,d = list(map(int,input().split()))
x = (n+d*2)//(d*2+1)
print(x)
# Original solution
N, D = list(map(int, input().split()))
ans = 0
i = D+1

while True:
    ans += 1
    if D+i >= N:
        break
    i += 2*D + 1

print(ans)

# Optimized solution
N, D = list(map(int, input().split()))

if N % (2*D+1) == 0:
    print((N // (2*D+1)))
else:
    print((int(N // (2*D+1)) + 1))
# Original solution
# B - Golden Apple

from math import ceil 
N, D = list(map(int, input().split()))
print((ceil(N/(2*D+1))))

# Optimized solution
# B - Golden Apple

N, D = list(map(int, input().split()))
# print(int((N+2*D)/(2*D+1)))
print(((N+2*D)//(2*D+1)))
# Original solution
import math
N, D = list(map(int, input().split()))
ob_range = 2 * D + 1
print((math.ceil(N / ob_range)))

# Optimized solution
import math
N, D = list(map(int, input().split()))

print((math.ceil(N / (2 * D + 1))))
# Original solution
N, Z, W = list(map(int, input().split()))
*A, = list(map(int, input().split()))

import sys
sys.setrecursionlimit(10**6)

memo = {}
def dfs(i, turn):
    if (i, turn) in memo:
        return memo[i, turn]
    if turn == 0:
        # X
        if i == 0:
            res = abs(W - A[-1])
        else:
            res = abs(A[i-1] - A[-1])
        for j in range(i+1, N):
            res = max(res, dfs(j, 1))
    else:
        # Y
        if i == 0:
            res = abs(Z - A[-1])
        else:
            res = abs(A[i-1] - A[-1])
        for j in range(i+1, N):
            res = min(res, dfs(j, 0))
    memo[i, turn] = res
    return res
print((dfs(0, 0)))


# Optimized solution
N, Z, W = list(map(int, input().split()))
*A, = list(map(int, input().split()))
if N == 1:
    print((abs(A[0] - W)))
else:
    print((max(abs(A[-1] - W), abs(A[-2] - A[-1]))))
# Original solution
# どちらか必ずa_Nのカードを持つ
import sys
from functools import lru_cache

sys.setrecursionlimit(4000)

N,Z,W = list(map(int,input().split()))
A = list(map(int,input().split()))
A.reverse()

# turn: true->X, false->Y
BOTTOM = A[0]

@lru_cache(maxsize=2000000)
def rec_X(i,y):
  return max(abs(BOTTOM-y),max((rec_Y(j,A[j]) for j in range(1,i)), default=0))

@lru_cache(maxsize=2000000)
def rec_Y(i,x):
  return min(abs(BOTTOM-x),min((rec_X(j,A[j]) for j in range(1,i)), default=float('inf')))

print((rec_X(N,W)))

# Optimized solution
# どちらか必ずa_Nのカードを持つ

N,Z,W = list(map(int,input().split()))
A = list(map(int,input().split()))
A.reverse()
A.append(W)

BOTTOM = A[0]

M = float('inf')
m = 0

for a in A[1:]:
  x = abs(BOTTOM-a)
  t = max(x,m)
  s = min(x,M)
  M = min(M,t)
  m = max(m,s)

print(t)
# Original solution
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def score(i,x,y,turn):
        if i==n-1:
            return abs(x-y)
        if (i,x,y,turn) in memo:
            return memo[(i,x,y,turn)]
        if turn:
            res=0
            for j in range(i+1,n):
                res=max(res,score(j,aa[j],y,not turn))
        else:
            res=10**16
            for j in range(i+1,n):
                res=min(res,score(j,x,aa[j],not turn))
        memo[(i,x,y,turn)]=res
        return res

    n,z,w=map(int, input().split())
    aa=list(map(int, input().split()))
    memo={}
    print(score(-1,z,w,True))

main()


# Optimized solution
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def MI(): return map(int, sys.stdin.readline().split())

def LI(): return list(map(int, sys.stdin.readline().split()))

def main():
    n, z, w = MI()
    aa = LI()
    if n - 2 >= 0:
        print(max(abs(aa[n - 1] - aa[n - 2]), abs(aa[n - 1] - w)))
    else:
        print(abs(aa[n - 1] - w))

main()
# Original solution
import sys
 
N, Z, W = list(map(int, input().split()))
A = list(map(int, input().split()))
inf = 10 ** 9 + 7
 
sys.setrecursionlimit(inf)
 
def calc(a, b):
  return abs(a - b)
 
def alphaBeta(X, Y, turn, depth, alpha, beta):
    if depth == N:
        return calc(X, Y)
    if turn:
        for i in range(depth, N):
            alpha = max(alpha, alphaBeta(A[i], Y, False, i+1, alpha, beta))
            if alpha >= beta:
                break
        return alpha
    else:
        for i in range(depth, N):
            beta = min(beta, alphaBeta(X, A[i], True, i+1, alpha, beta))
            if alpha >= beta:
                break
        return beta
 
print((alphaBeta(Z, W, True, 0, -1, inf)))

# Optimized solution
import sys

N, Z, W = list(map(int, input().split()))
A = list(map(int, input().split()))

ans = abs(A[-1] - W)
if N != 1:
    ans = max(ans, abs(A[-1] - A[-2]))
print(ans)
# Original solution
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,k = LI()
    a = LI()
    d = defaultdict(lambda:0)
    for i in a:
        d[i] += 1
    d = list(d.values())
    d.sort()
    ans = 0
    for i in range(len(d)-k):
        ans += d[i]
    print(ans)
    return

#B
def B():
    n,z,w = LI()
    a = LI()
    if n == 1:
        print((abs(a[0]-w)))
        return
    ans = max(abs(a[-1]-w),abs(a[-2]-a[-1]))
    print(ans)
    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#Solve
if __name__ == "__main__":
    B()


# Optimized solution
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,x,y = LI()
    a = LI()
    ans = abs(a[-1]-y)
    if n > 1:
        ans = max(ans,abs(a[-2]-a[-1]))
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()
# Original solution
import sys
sys.setrecursionlimit(10 ** 6)


def dfs(x, y, memo, A, N, Z, W):
    X = Z if x == 0 else A[x - 1]
    Y = W if y == 0 else A[y - 1]

    if memo[x][y] >= 0:
        return memo[x][y]
    else:
        if x == N or y == N:
            rst = abs(X - Y)
        else:
            if x <= y:
                rst = 0
                for i in range(y + 1, N + 1):
                    rst = max(rst, dfs(i, y, memo, A, N, Z, W))
            else:
                rst = 10 ** 10
                for i in range(x + 1, N + 1):
                    rst = min(rst, dfs(x, i, memo, A, N, Z, W))
        memo[x][y] = rst
        return rst


def main():
    # import sys
    # readline = sys.stdin.readline
    # readlines = sys.stdin.readlines

    N, Z, W = list(map(int, input().split()))
    A = list(map(int, input().split()))
    memo = [[-1] * (N + 1) for _ in range(N + 1)]
    ans = dfs(0, 0, memo, A, N, Z, W)
    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
N, Z, W = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [[-1] * (N + 1) for _ in range(N + 1)]

for x in range(N, -1, -1):
    for y in range(N, -1, -1):
        if x == y:
            continue
        X = Z if x == 0 else A[x - 1]
        Y = W if y == 0 else A[y - 1]
        if x == N or y == N:
            rst = abs(X - Y)
        elif x - y == 1:
            rst = 10 ** 10
            for j in range(N, x, -1):
                rst = min(rst, dp[x][j])
        elif x - y > 1:
            rst = dp[x][y + 1]
        elif y - x == 1:
            rst = 0
            for i in range(N, y, -1):
                rst = max(rst, dp[i][y])
        elif y - x > 1:
            rst = dp[x + 1][y]
        else:
            raise Exception
        dp[x][y] = rst

ans = 0
for i in range(N):
    ans = max(ans, dp[i + 1][0])
print(ans)