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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> piipi;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back
int n, m;
int a[5005], b[5005][205];
int dp[205];
ll sum[5005];
ll ans = 0;
void dfs(int s, int e, int optl, int optr){
    if(s > e) return;
    int mid = (s+e)/2;
    for(int j=1;j<=m;j++) dp[j] = 0;
    for(int i=mid;i<max(mid, optl);i++){
        for(int j=1;j<=m;j++) dp[j] = max(dp[j], b[i][j]);
    }
    ll res = -1e18, opt = mid;
    for(int i=max(mid, optl);i<=max(mid, optr);i++){
        ll tmp = 0;
        for(int j=1;j<=m;j++){
            dp[j] = max(dp[j], b[i][j]);
            tmp += dp[j];
        }
        if(res < tmp - (sum[i] - sum[mid])){
            res = tmp - (sum[i] - sum[mid]);
            opt = i;
        }
    }
    ans = max(ans, res);
    dfs(s, mid-1, optl, opt);
    dfs(mid+1, e, opt, optr);
}
int main(){
    scanf("%d%d", &n, &m);
    for(int i=2;i<=n;i++){
        scanf("%d", &a[i]);
        sum[i] = sum[i-1] + a[i];
    }   
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            scanf("%d", &b[i][j]);
        }
    }
    dfs(1, n, 1, n);
    printf("%lld\n", ans);
}