# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416791 | 2021-06-02T23:51:31 Z | minzoa | Stove (JOI18_stove) | Python 3 | 0 ms | 0 KB |
n,k=map(int, input().split())l=[] for i in range(n):l.append(int(input()))d=[] for i in range(1,n):d.append(l[i]-l[i-1])d=sorted(d)ans=0 for i in range(n-k):ans+=d[i]-1 print(ans+n)