#include<cstdio>
#include<algorithm>
using namespace std;
int n, m;
int w[5100][210];
long long S[5100], A[5100];
struct AA {
	int st[5100][2];
	int top;
	void Put(int num, int x) {
		int prev = 0;
		while (top && st[top][0] <= x){
			S[st[top][1]] -= st[top][0] - prev;
			prev = st[top][0];
			top--;
		}
		if (top)S[st[top][1]] += prev - x;
		top++;
		st[top][0] = x, st[top][1] = num, S[num] += x;
	}
}T[210];
int main() {
	int i, j;
	scanf("%d%d", &n, &m);
	for (i = 1; i < n; i++)scanf("%lld", &A[i]);
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= m; j++) {
			scanf("%d", &w[i][j]);
		}
	}
	long long res = 0;
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= m; j++) {
			T[j].Put(i, w[i][j]);
		}
		long long s = 0;
		for (j = i; j >= 1; j--) {
			s += S[j];
			res = max(res, s);
			s-=A[j - 1];
		}
	}
	printf("%lld\n", res);
}