#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define MAX 5002

int n;
int m;

long long int a[MAX];

long long int b[MAX][202];

struct MIN_BIT{
	vector<int> bit;
	void add(int i, int x){
		i++;
		while (i < bit.size()){
			bit[i] = min(bit[i], x);
			i += i&-i;
		}
	}
	void resize(int i){
		bit.assign(i, INT_MAX);
	}
	int sum(int i){
		int r = INT_MAX;
		i++;
		while (i){
			r = min(r, bit[i]);
			i -= i&-i;
		}
		return r;
	}
};
struct MAX_BIT{
	vector<int> bit;
	void add(int i, int x){
		i++;
		while (i < bit.size()){
			bit[i] = max(bit[i], x);
			i += i&-i;
		}
	}
	void resize(int i){
		bit.assign(i, -1);
	}
	int sum(int i){
		int r = -1;
		i++;
		while (i){
			r = max(r, bit[i]);
			i -= i&-i;
		}
		return r;
	}
};

vector<pair<pair<int, int>, int> > ev[MAX];


void add_rect(int a, int b, int c, int d,int x){
	if (a > b){
		swap(a, b);
	}
	if (c > d){
		swap(c, d);
	}
	ev[a].push_back(make_pair(make_pair(c, d), x));
	ev[b+1].push_back(make_pair(make_pair(c, d), -x));
}

struct st{
	long long int val;
	long long int lazy;
	st(){
		val = 0;
		lazy = 0;
	}
};
st seg[MAX * 4];

void update(int b){
	seg[b].val += seg[b].lazy;
	if (b * 2 + 2 < MAX * 4){
		seg[b * 2 + 1].lazy += seg[b].lazy;
		seg[b * 2 + 2].lazy += seg[b].lazy;
	}
	seg[b].lazy = 0;
}
inline void add(int b, int l, int r, int ll, int rr, int x){
	update(b);
	if (rr <= l || r <= ll){
		return;
	}
	if (ll <= l&&r <= rr){
		seg[b].lazy += x;
		update(b);
		return;
	}
	add(b * 2 + 1, l, (l + r) >> 1, ll, rr, x);
	add(b * 2 + 2, (l + r) >> 1, r, ll, rr, x);
	seg[b].val = max(seg[b * 2 + 1].val , seg[b * 2 + 2].val);
}

int main(){
	cin >> n >> m;
	for (int i = 0; i+1 < n; i++){
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < m; j++){
			scanf("%lld", &b[i][j]);
		}
	}
	for (int j = 0; j <m ; j++){
		vector<int> val;
		for (int i = 0; i <n; i++){
			val.push_back(b[i][j]);
		}
		sort(val.begin(), val.end());
		val.erase(unique(val.begin(), val.end()), val.end());
		MAX_BIT mxb;
		mxb.resize(val.size() + 2);
		vector<int> lef;
		for (int i = 0; i < n; i++){
			int id = lower_bound(val.begin(), val.end(),b[i][j]) - val.begin();
			id = val.size() - id;
			int sum = mxb.sum(id-1);
			sum = max(sum+1, 0);
			lef.push_back(sum);
			mxb.add(id, i);
		}
		MIN_BIT mib;
		mib.resize(val.size() + 2);
		vector<int> rig;
		for (int i = n - 1; i >= 0; i--){
			int id = lower_bound(val.begin(), val.end(), b[i][j]) - val.begin();
			id = val.size() - id;
			int sum = mib.sum(id);
			sum = min(sum - 1, (int)n - 1);
			rig.push_back(sum);
			mib.add(id, i);
		}
		reverse(rig.begin(), rig.end());
		for (int i = 0; i < lef.size(); i++){
			add_rect(lef[i], i, i, rig[i],b[i][j]);
			add_rect(i, rig[i], lef[i], i,b[i][j]);
			add_rect(i, i, i, i, -b[i][j]);
		}
	}
	for (int i = 0; i+1 < n; i++){
		add(0, 0, n, i+1, n, -a[i]);
	}
	long long int maxt = -1;
	for (int i = 0; i < n; i++){
		if (i){
			add(0, 0, n, 0, i, -a[i-1]);
			add(0, 0, n, i, n, +a[i-1]);
		}
		for (int j = 0; j < ev[i].size(); j++){
			add(0, 0, n, ev[i][j].first.first, ev[i][j].first.second + 1, ev[i][j].second);
		}
		long long int ans = seg[0].val;
		maxt = max(maxt, ans);
	}
	printf("%lld\n", maxt);
	return 0;
}

Measured memory_bytes: 123008