#include<bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll N = 5005, M = 205;

ll n, m, a[N], b[N][M], v[M], ans;

struct maxtree {
	ll v[4*N], lim;
	void init (ll P) {
		for(lim=1;lim<=n;lim<<=1);
		for(ll i=1;i<=n;i++) v[lim+i] = b[i][P];
		for(ll i=lim;--i;) v[i] = max(v[2*i], v[2*i+1]);
	}
	ll get (ll S, ll E) {
		ll R = 0; S += lim; E += lim;
		while(S<=E) {
			if(S%2==1) {R = max(R, v[S]); S++;}
			if(E%2==0) {R = max(R, v[E]); E--;}
			S >>= 1; E >>= 1;
		}
		return R;
	}
} seg[M];

void solve (ll S, ll E, ll L, ll R) {
	ll I = (S+E)/2, V = 0, T = max(L, I);
	for(ll i=1;i<=m;i++) {
		v[i] = seg[i].get(I, T);
		V += v[i];
	}
	pll O = pll(V-a[T]+a[I], T);
	for(ll i=T+1;i<=R;i++) {
		V = 0;
		for(ll j=1;j<=m;j++) {
			v[j] = max(v[j], b[i][j]);
			V += v[j];
		}
		O = max(O, pll(V-a[i]+a[I], i));
	}
	ans = max(ans, O.X);
	if(S == E) return;
	solve(S, I, L, O.Y);
	solve(I+1, E, O.Y, R);
}

int main()
{
	scanf("%lld%lld",&n,&m);
	for(ll i=2;i<=n;i++) {
		scanf("%lld",&a[i]); a[i] += a[i-1];
	}
	for(ll i=1;i<=n;i++) for(ll j=1;j<=m;j++) {
		scanf("%lld",&b[i][j]);
	}
	for(ll i=1;i<=m;i++) seg[i].init(i);
	solve(1, n, 1, n);
	printf("%lld\n",ans);
}
