// Ala be zekrellah tatmaenolgholoob ...
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F first
#define S second
#define MP make_pair
const int maxn = 5e3+9;
const ll mod = 1e9+7;

stack <int> st[205];
ll a[maxn], b[maxn][205], sum[maxn], dp[maxn][maxn]; 

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i < n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		for (int t = 1; t <= m; t++)
			cin >> b[i][t];
	// dp
	for (int e = 1; e <= n; e++) {
		memset(sum, 0, sizeof sum);
		ll last = 0;
		for (int s = 1; s <= e; s++)
			dp[s][e] = dp[s][e - 1];
		for (int i = 1; i <= m; i++) {
			// add col[i] and update
			last = 0;
			sum[e] += b[e][i];
			while (st[i].size() && b[st[i].top()][i] < b[e][i]) {
				sum[st[i].top()] += last;
				last = b[st[i].top()][i];
				sum[st[i].top()] -= last;
				st[i].pop();
			}
			if (st[i].size()) {
				sum[st[i].top()] -= b[e][i];
				sum[st[i].top()] += last;
			}
			st[i].push(e);
		}
		// update from sum
		for (int s = e; s >= 1; s--) {
			sum[s] += sum[s + 1];
			dp[s][e] += sum[s];
		}
	}
	// ans
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		ll f = 0;
		for (int t = i; t <= n; t++) {
			ans = max(ans, dp[i][t] - f);
			f += a[t];
		}
	}
	cout << ans << "\n";
}

