#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
#define inf 2147483647
#define eps 1e-9
using namespace std;
typedef long long ll;
ll n,m,L,R,st[5010],num[5010],b[210][5010],l[210][5010],r[210][5010];
ll ans=0,a[5010],pre[5010],sq[5010][5010];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<n;i++){
        scanf("%lld",&a[i]);
        pre[i+1]=pre[i]+a[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            scanf("%d",&b[j][i]);
        }
    }
    for(int i=1;i<=m;i++){
        L=R=0;
        for(int j=1;j<=n;j++){
            while(L&&b[i][j]>st[L])L--;
            l[i][j]=L?num[L]+1:1;
            st[++L]=b[i][j];
            num[L]=j;
        }
        for(int j=n;j;j--){
            while(R&&b[i][j]>st[R])R--;
            r[i][j]=R?num[R]-1:n;
            st[++R]=b[i][j];
            num[R]=j;
        }
        for(int j=1;j<=n;j++){
            sq[l[i][j]][j]+=b[i][j];
            sq[l[i][j]][r[i][j]+1]-=b[i][j];
            sq[j+1][j]-=b[i][j];
            sq[j+1][r[i][j]+1]+=b[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            sq[i][j]+=sq[i][j-1];
        }
        for(int j=1;j<=n;j++){
            sq[i][j]+=sq[i-1][j];
        }
        for(int j=i;j<=n;j++){
            ans=max(ans,sq[i][j]-pre[j]+pre[i]);
        }
    }
    printf("%lld",ans);
    return 0;
}