n,k=map(int,input().split())
a=list(map(int,input().split()))
c=l=0
for i in range(n):
    c=0
    for j in range(n):
        s=abs(a[i]-a[j])
        if s>k:
            c+=1
    if c>=((n//2)+1):
        l+=1
print(k)
        