#include<bits/stdc++.h>
using namespace std;
int n,m;
int w[10010];
int t[110];
int cnt=0;
int main()
{
int tt=-1,hh=0;
cin>>n>>m;
hh=m;
while(n--){
tt++;
cin>>w[tt];
}
for(int i=0;i<m;i++)
{
t[i]=w[i];
}
while(hh<=tt+m)
{
for(int i=0;i<m;i++)
{
t[i]--;
if(t[i]==0)
{
t[i]=w[hh];
hh++;
}
}
cnt++;
}
cout<<cnt<<endl;
return 0;
}
玄学 int t[110] 过不了, int t[100] 能过, int t[99]也能过,为什么?