#include<iostream>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<ctime>
#include<climits>
#include<queue>
#define ll long long
using namespace std;
const ll N=5010,M=210;
ll sum[N][N],n,m,a[N],b[N][M],_sum[N],ans=LLONG_MIN,x[N],y[N];
ll q[N],head,tail;
int main()
{
	ll i,j,k,t;
	scanf("%lld%lld",&n,&m);
	for(i=2;i<=n;i++) scanf("%lld",&a[i]),_sum[i]=_sum[i-1]+a[i];
	for(i=1;i<=n;i++) for(j=1;j<=m;j++) scanf("%lld",&b[i][j]);
	for(i=1;i<=m;i++)
	{
		head=tail=0;
		x[1]=1;
		q[tail++]=1;
		for(j=2;j<=n;j++) 
		{
			while(tail!=head && b[q[tail-1]][i]<b[j][i]) tail--; 
            x[j]=(head==tail?1:q[tail-1]+1),q[tail++]=j;
		}
	    head=tail=0;
		y[n]=n;
		q[tail++]=n;
		for(j=n-1;j>=1;j--) 
		{
			while(tail!=head && b[q[tail-1]][i]<b[j][i]) tail--; 
            y[j]=(head==tail?n:q[tail-1]-1),q[tail++]=j;
		}
		for(j=1;j<=n;j++)
		{
			sum[x[j]][j]+=b[j][i];
			sum[j+1][y[j]+1]+=b[j][i];
			sum[x[j]][y[j]+1]-=b[j][i];
			sum[j+1][j]-=b[j][i];
		}
	}
	for(i=1;i<=n;i++) for(j=1;j<=n;j++) sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
	for(i=1;i<=n;i++) for(j=i;j<=n;j++) ans=max(ans,sum[i][j]-(_sum[j]-_sum[i]));
	cout<<ans<<endl; 
	return 0;
}