#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int N=5005;
const int M=205;

int n,m,w[N][M],lef[N],rig[N],tot;
LL dis[N],tmp[N],s[N];
struct data{int x,l,r,c;}op[N*M*2];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

bool cmp(data a,data b)
{
	return a.x<b.x;
}

int main()
{
	n=read();m=read();
	for (int i=2;i<=n;i++) dis[i]=dis[i-1]+(LL)read();
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			w[i][j]=read();
	for (int j=1;j<=m;j++)
	{
		for (int i=1;i<=n;i++)
		{
			lef[i]=i-1;
			while (lef[i]&&w[lef[i]][j]<w[i][j]) lef[i]=lef[lef[i]];
		}
		for (int i=n;i>=1;i--)
		{
			rig[i]=i+1;
			while (rig[i]<=n&&w[rig[i]][j]<=w[i][j]) rig[i]=rig[rig[i]];
		}
		for (int i=1;i<=n;i++)
		{
			op[++tot].x=lef[i]+1;op[tot].l=i;op[tot].r=rig[i]-1;op[tot].c=w[i][j];
			op[++tot].x=i+1;op[tot].l=i;op[tot].r=rig[i]-1;op[tot].c=-w[i][j];
		}
	}
	sort(op+1,op+tot+1,cmp);
	LL ans=0;int now=1;
	for (int i=1;i<=n;i++)
	{
		memset(tmp,0,sizeof(tmp));
		while (now<=tot&&op[now].x==i) tmp[op[now].l]+=op[now].c,tmp[op[now].r+1]-=op[now].c,now++;
		for (int j=1;j<=n;j++) tmp[j]+=tmp[j-1],s[j]+=tmp[j],ans=j<i?ans:max(ans,s[j]-dis[j]+dis[i]);
	}
	printf("%lld",ans);
	return 0;
}