#include <bits/stdc++.h>
#define int long long
const int N=5005;
int n,m,a[N],b[205][N],tp[205],s[205][N],c[N],ans;
signed main(){
	scanf("%lld%lld",&n,&m);
	for (int i=2;i<=n;i++) scanf("%lld",&a[i]);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++) scanf("%lld",&b[j][i]);
	for (int l=n;l>=1;l--){
		for (int i=1;i<=m;i++){
			while (tp[i] && b[i][l]>=b[i][s[i][tp[i]]]){
				int x=s[i][tp[i]];
				c[x]-=b[i][x];
				c[s[i][--tp[i]]]+=b[i][x];
			}
			if (tp[i]) c[s[i][tp[i]]]-=b[i][l];
			s[i][++tp[i]]=l;
			c[l]+=b[i][l];
		}
		int sum=c[l];
		ans=std::max(ans,c[l]); 
		for (int i=l+1;i<=n;i++) sum+=c[i]-a[i],ans=std::max(ans,sum);
	}
	printf("%lld\n",ans);
}
