#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int N=5005,M=205;

typedef long long LL;

int n,m,b[M][N],Top,d[N],le[N],ri[N];

LL f[N][N],a[N],ans;

int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<n;i++)
	{
		scanf("%d",&a[i]); a[i]+=a[i-1];
	}
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) scanf("%d",&b[j][i]);
	for (int j=1;j<=m;j++)
	{
		Top=d[0]=0;
		for (int i=1;i<=n;i++)
		{
			for (;Top>0 && b[j][d[Top]]<b[j][i];Top--);
			le[i]=d[Top]+1;
			d[++Top]=i;
		}
		Top=0; d[0]=n+1;
		for (int i=n;i;i--)
		{
			for (;Top>0 && b[j][d[Top]]<=b[j][i];Top--);
			ri[i]=d[Top]-1;
			d[++Top]=i;
			f[le[i]][i]+=b[j][i];
			f[le[i]][ri[i]+1]-=b[j][i];
			f[i+1][i]-=b[j][i];
			f[i+1][ri[i]+1]+=b[j][i];
		}
	}
	ans=-1e16;
	for (int i=1;i<=n;i++) for (int 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]-a[j-1]+a[i-1]);
	}
	printf("%lld\n",ans);
	return 0;
}