#include<stdio.h>
#define N (5010)
#define M (210)
#define MAXA (1000000010)
typedef long long LL;
int lst[N],pre[N],b[N][M],pos[N];
LL a[N][N],s[N];
void add(int x1, int x2, int y1, int y2, int z){
	a[x1][y1]+=z;
	a[x1][y2+1]-=z;
	a[x2+1][y1]-=z;
	a[x2+1][y2+1]+=z;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=2,x;i<=n;i++) scanf("%d",&x),s[i]=s[i-1]+x;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=m;j++){
			scanf("%d",b[i]+j);
		}
	}
	for (int j=1,cl;j<=m;j++){
		lst[pos[cl=0]=0]=MAXA;
		for (int i=1;i<=n;i++){
			while (b[i][j]>=lst[cl]) cl--;
			pre[i]=pos[cl];
			pos[++cl]=i;
			lst[cl]=b[i][j];
		}
		pos[0]=n+1;
		lst[cl=0]=MAXA;
		for (int i=n;i;i--){
			while (b[i][j]>lst[cl]) cl--;
			add(pre[i]+1,i,i,pos[cl]-1,b[i][j]);
			pos[++cl]=i;
			lst[cl]=b[i][j];
		}
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			a[i][j]+=a[i][j-1];
		}
	}
	LL ans=0;
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			a[i][j]+=a[i-1][j];
			if (i<=j&&a[i][j]-(s[j]-s[i])>ans){
				ans=a[i][j]-(s[j]-s[i]);
			}
		}
	}
	printf("%lld\n",ans);
}