#include <bits/stdc++.h>
using namespace std;
#define N 5010
#define ll long long
int n,m,b[N][N],q[N],q1[N],L[N][N],R[N][N];
ll sum[N],ans=0,mp[N][N];
inline char gc(){
	static char *S,*T,buf[1<<16];
	if(T==S){T=(S=buf)+fread(buf,1,1<<16,stdin);if(T==S) return EOF;}
	return *S++;
}
inline int read(){
	int x=0,f=1;char ch=gc();
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1;ch=gc();}
	while('0'<=ch && ch<='9') x=x*10+ch-'0',ch=gc();
	return x*f;
}
int main(){
	n=read();m=read();
	for(int i=2;i<=n;++i) sum[i]=sum[i-1]+read();
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			b[j][i]=read();
	for(int i=1;i<=m;++i){
		int top=0;
		for(int j=1;j<=n;++j){
			while(top && q[top]<b[i][j]) --top;
			L[i][j]=top?q1[top]+1:1;
			q1[++top]=j;q[top]=b[i][j];
		}
		top=0;
		for(int j=n;j>=1;--j){
			while(top && q[top]<b[i][j]) --top;
			R[i][j]=top?q1[top]-1:n;
			q1[++top]=j;q[top]=b[i][j];
		}
		for(int j=1;j<=n;++j){
			mp[L[i][j]][j]+=b[i][j];
			mp[L[i][j]][R[i][j]+1]-=b[i][j];
			mp[j+1][j]-=b[i][j];
			mp[j+1][R[i][j]+1]+=b[i][j];
		}
	}
	for(int i=1;i<=n;++i){
		for(int j=1;j<=n;++j) mp[i][j]+=mp[i][j-1];
		for(int j=1;j<=n;++j) mp[i][j]+=mp[i-1][j];
		for(int j=i;j<=n;++j) ans=max(ans,mp[i][j]-sum[j]+sum[i]);
	}
	printf("%lld\n",ans);
	return 0;
}