#include<bits/stdc++.h>
using namespace std;
#define N 5000 + 5
#define M 200 + 5
#define rep(i, l, r) for(int i = l; i <= r; ++i)
#define dep(i, l, r) for(int i = r; i >= l; --i)
long long ans, S[N], c[N][N];
int n, m, top, a[N], l[N], r[N], st[N], b[M][N]; 
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
void solve(int l, int r, int p, int k){
    if(l > r) return;
    c[l][p] += k, c[p + 1][p] -= k, c[l][r + 1] -= k, c[p + 1][r + 1] += k;
}
int main(){
    n = read(), m = read();
    rep(i, 1, n - 1) a[i] = read(), S[i + 1] = S[i] + a[i];
    rep(i, 1, n) rep(j, 1, m) b[j][i] = read();
    rep(i, 1, m){
        top = 0, memset(l, 0, sizeof(l)), memset(r, 0, sizeof(r));
        dep(j, 1, n){
            while(top && b[i][j] >= b[i][st[top]]) l[st[top]] = j, --top;
            st[++top] = j;
        }
        top = 0;
        rep(j, 1, n){
            while(top && b[i][j] > b[i][st[top]]) r[st[top]] = j, --top;
            st[++top] = j;
        }
        rep(j, 1, n) ++l[j], r[j] = r[j] ? r[j] - 1 : n;
        rep(j, 1, n) solve(l[j], r[j], j, b[i][j]);
    }
    rep(i, 1, n) rep(j, 1, n) c[i][j] += c[i - 1][j] + c[i][j - 1] - c[i - 1][j - 1];
    rep(i, 1, n) rep(j, i, n) ans = max(ans, c[i][j] - S[j] + S[i]);
    printf("%lld", ans);
    return 0;
}