long s,q;i,j,a[9];main(){for(scanf("%d%*d",&q);~scanf("%d",a+i);j=++i)for(q+=a[i];j--;)a[j+1]