#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=5050,M=220,oo=1000000001;
int i,j,k,n,m,ch;
int A[N],B[N][M],l[N],r[N];
ll ans,f[N][N],s[N];
void R(int &x) {
	x=0;ch=getchar();
	while (ch<'0' || '9'<ch) ch=getchar();
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
}
void W(ll x) {
	if (x>=10) W(x/10);
	putchar(x%10+'0');
}
void Add(int x1,int y1,int x2,int y2,int x) {
	f[x1][y1]+=x;
	f[x1][y2+1]-=x;
	f[x2+1][y1]-=x;
	f[x2+1][y2+1]+=x;
}
int main() {
	R(n);R(m);
	for (i=1;i<n;i++) R(A[i]);
	for (i=1;i<n;i++) s[i]=s[i-1]+A[i];
	for (i=1;i<=n;i++)
		for (j=1;j<=m;j++) R(B[i][j]);
	for (j=1;j<=m;j++) {
		B[0][j]=B[n+1][j]=oo;
		for (i=1;i<=n;i++) {
			l[i]=i-1;
			while (B[l[i]][j]<B[i][j]) l[i]=l[l[i]];
		}
		for (i=n;i;i--) {
			r[i]=i+1;
			while (B[r[i]][j]<=B[i][j]) r[i]=r[r[i]];
		}
		for (i=1;i<=n;i++) Add(l[i]+1,i,i,r[i]-1,B[i][j]);
	}
	for (i=1;i<=n;i++)
		for (j=1;j<=n;j++) {
			f[i][j]+=f[i-1][j]+f[i][j-1]-f[i-1][j-1];
			if (i<=j) ans=max(ans,f[i][j]-(s[j-1]-s[i-1]));
		}
	W(ans);puts("");
}