#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 5010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

struct T {
	pl v;
	T(pl v = pl(0, 0)) : v(v) {}
	T operator+(const T& t) { return T(max(v, t.v)); }
	friend ostream& operator<<(ostream& out, const T& t) {
		out << t.v; return out;
	}
};

struct segtree{
	int n; vector<T> seg;
	void init(int mx) {
		n = 1;
		while(n < mx) n *= 2;
		seg = vector<T>(n * 2);
	}
	segtree(int mx = 0) {
		init(mx);
	}
	void update(int i, T x) {
		i += n - 1;
		seg[i] = x;
		while(i > 0) {
			i = (i - 1) / 2;
			seg[i] = seg[i * 2 + 1] + seg[i * 2 + 2];
		}
	}
	T ga(int a, int b, int k, int l, int r) {
		if(b <= l || r <= a) return T();
		if(a <= l && r <= b) return seg[k];
		else {
			T lv = ga(a, b, k * 2 + 1, l, (l + r) / 2);
			T rv = ga(a, b, k * 2 + 2, (l + r) / 2, r);
			return lv + rv;
		}
	}
	void show() {
		vector<T> tmp;
		rep(i, 0, n) tmp.push_back(get(i, i + 1));
		debug(tmp);
	}
	//edit from here
	T get(int a, int b) { return ga(a, b, 0, 0, n); } //[a, b)
};

int N, M;
segtree seg;
ll A[MAX_N];
ll B[5010][210];
ll S[5010][5010];

void addblock(int x1, int x2, int y1, int y2, ll x) {
	S[x1][x2] += x;
	S[x1][y2] -= x;
	S[y1][x2] -= x;
	S[y1][y2] += x;
}


void dfs(int a, int b, int mi, int mj) {
	if(a == b) return;
	pl p = seg.get(a, b).v;
	ll v = p.fst; int t = p.sec;
	addblock(mi, t, t + 1, mj, v);
	dfs(a, t, mi, t);
	dfs(t + 1, b, t + 1, mj);
}

void solve() {
	cin >> N >> M;
	rep(i, 1, N) cin >> A[i];
	rep(i, 1, N + 1) A[i + 1] += A[i];
	rep(i, 0, N) 
		rep(j, 0, M) cin >> B[i][j];

	seg.init(N);
	rep(i, 0, M) {
		rep(j, 0, N) seg.update(j, T(pl(B[j][i], j)));
		dfs(0, N, 0, N);
		// rep(i, 0, N) {
		// 	debug(vi(S[i], S[i] + N + 1));
		// }
	}
	rep(i, 0, N + 1) {
		rep(j, 0, N) {
			S[i][j + 1] += S[i][j];
		}
	}
	rep(j, 0, N + 1) {
		rep(i, 0, N) {
			S[i + 1][j] += S[i][j];
		}
	}
	// rep(i, 0, N) {
	// 	debug(vi(S[i], S[i] + N + 1));
	// }
	ll ans = 0;
	rep(i, 0, N) {
		rep(j, i, N + 1) {
			MAX(ans, S[i][j] - (A[j] - A[i]));
		}
	}
	cout << ans << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 204928