#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
using namespace std;
typedef long long ll;
const int maxn=5000+10,maxm=200+10;
ll v[maxn][maxn],d[maxn];
int b[maxm][maxn],a[maxn];
int sta[maxn],fa[maxn],lc[maxn],rc[maxn],L[maxn],R[maxn];
int i,j,k,l,t,n,m,top,root;
ll ans;
void ins(int mid,int l,int r,int x){
	v[l][r]+=(ll)x;
	v[l][mid-1]-=(ll)x;
	v[mid+1][r]-=(ll)x;
}
void dfs(int x){
	L[x]=R[x]=x;
	if (lc[x]){
		dfs(lc[x]);
		L[x]=L[lc[x]];
	}
	if (rc[x]){
		dfs(rc[x]);
		R[x]=R[rc[x]];
	}
	ins(x,L[x],R[x],a[x]);
}
void work(int id){
	int i,j;
	fo(i,1,n) a[i]=b[id][i];
	fo(i,1,n) fa[i]=lc[i]=rc[i]=0;
	top=0;
	fo(i,1,n){
		while (top&&a[i]>a[sta[top]]){
			if (fa[sta[top]]) rc[sta[top]]=i;
			rc[sta[top]]=lc[i];
			lc[i]=sta[top];
			top--;
		}
		fa[i]=sta[top];
		rc[sta[top]]=i;
		sta[++top]=i;
	}
	root=sta[1];
	dfs(root);
}
int main(){
	scanf("%d%d",&n,&m);
	fo(i,2,n){
		scanf("%d",&d[i]);
		d[i]+=d[i-1];
	}
	fo(i,1,n)
		fo(j,1,m) scanf("%d",&b[j][i]);
	fo(i,1,m) work(i);
	fo(i,1,n)
		fd(j,n,i)
			v[i][j]=v[i][j]+v[i-1][j]+v[i][j+1]-v[i-1][j+1];
	fo(i,1,n)
		fo(j,i,n)
			ans=max(ans,v[i][j]-(d[j]-d[i]));
	printf("%lld\n",ans);
}