#include <bits/stdc++.h>

using namespace std;

#define int long long

int n,m;
int a[5001], f[5001];
int b[5001][201];
int log_2[5001];
int rmq[201][5001][16];

void prepare()
{
	int cur = 1, val = -1;
	for (int i=1;i<=5000;i++)
	{
		if (i == cur)	
		{
			cur *= 2;
			val++;
		}	
		log_2[i] = val;
	}
}

int val(int l,int r)
{
	int d = (r-l+1);
	int z = log_2[d];
	int ans = (a[l] - a[r]);
	for (int k=1;k<=m;k++)
		ans += max(rmq[k][l][z],rmq[k][r-(1<<z)+1][z]);			
	return ans;		
}

void cal(int l,int r,int opt_l,int opt_r)
{
	if (l > r)
		return;
	int mi = (l+r)/2;
	int opt_val = -1e18, pos = -1;
	for (int i=opt_l;i<=min(mi,opt_r);i++)
	{
		int cost = val(i,mi);
		if (cost > opt_val)
		{
			opt_val = cost;
			pos = i;
		}
	}
	f[mi] = opt_val;
	cal(l,mi-1,opt_l,pos);
	cal(mi+1,r,pos,opt_r);
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	prepare();
	cin >> n >> m;
	for (int i=2;i<=n;i++)
	{
		int d; cin >> d;
		a[i] = a[i-1] + d;
	}	
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
		{
			cin >> b[i][j];
			rmq[j][i][0] = b[i][j];
		}
	for (int k=1;k<=m;k++)
		for (int j=1;j<=15;j++)
			for (int i=1;i+(1<<j)-1<=n;i++)
				rmq[k][i][j] = max(rmq[k][i][j-1],rmq[k][i+(1<<(j-1))][j-1]);
	cal(1,n,1,n);
	int ans = -1e18;
	for (int i=1;i<=n;i++)
		ans = max(ans,f[i]);
	cout << ans;	
}