// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

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

const int N=5000+10,M=200+10;

int n,m,a[N],b[N][M];
int sta[M][N],top[M];
ll d[N];

void add(int l,int r,int x) {
	if (l>r) return;
	d[l]+=x,d[r+1]-=x;
}

int main() {
	n=read(),m=read();
	for (int i=2;i<=n;++i) a[i]=read();
	for (int i=1;i<=n;++i)
		for (int j=1;j<=m;++j) b[i][j]=read();
	ll ans=0;
	for (int i=1;i<=n;++i) {	
		for (int j=1;j<=m;++j) {
			add(i,i,b[i][j]);
			while (top[j]&&b[sta[j][top[j]]][j]<=b[i][j]) {
				add(sta[j][top[j]-1]+1,sta[j][top[j]],b[i][j]-b[sta[j][top[j]]][j]);
				--top[j];
			}
			sta[j][++top[j]]=i;
		}
		add(1,i-1,-a[i]); ll now=0;
		for (int j=1;j<=i;++j) now+=d[j],ans=max(ans,now);
	}
	printf("%lld\n",ans);
	return 0;
}