tot=int(input())
diffmax=float(input())
listechiffres=[0]*tot
for t in range(tot):
listechiffres[t]=float(input())
compte=0
tout=0
lissageparfait=0
while lissageparfait!=1:
tout=0
for i in range(len(listechiffres)-1):
if abs(listechiffres[i]-listechiffres[i+1])<diffmax:
tout+=1
if tout ==len(listechiffres)-1:
lissageparfait=1
copie=list(listechiffres)
for j in range(len(listechiffres)-2):
copie[j+1]=(listechiffres[j]+listechiffres[j+2])/2
listechiffres=list(copie)
compte+=1
print(compte-1)
#if listechiffres[i]==listechiffres[i+1]:
# tout+=1
# if tout ==len(listechiffres)-2:
# lissageparfait=1
To embed this project on your website, copy the following code and paste it into your website's HTML: