/63B.py
https://bitbucket.org/alculquicondor/codeforces · Python · 14 lines · 14 code · 0 blank · 0 comment · 5 complexity · 39b027180ef67a217044a5d3d81a2bf7 MD5 · raw file
- s=raw_input().split()
- n=int(s[0])
- k=int(s[1])
- A=[0]*(k+1)
- for x in [int(j) for j in raw_input().split()]:
- A[x]+=1
- r=0
- while A[k]!=n:
- r+=1
- for i in range(k-1,0,-1):
- if(A[i]>0):
- A[i]-=1
- A[i+1]+=1
- print r