#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=5010;
int n,m,b[maxn][maxn],s[maxn],l[maxn][maxn],r[maxn][maxn],w[maxn];
ll a[maxn],A[maxn][maxn];
int main(){
    scanf("%d%d",&n,&m);
    for(int i=2;i<=n;i++)scanf("%lld",&a[i]),a[i]+=a[i-1];
    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++){
        int top=0;
        for(int j=1;j<=n;j++){
            while(top&&b[i][j]>b[i][s[top]])top--;
            if(top)l[i][j]=s[top]+1;else l[i][j]=1;
            s[++top]=j;
        }
        top=0;
        for(int j=n;j>=1;j--){
            while(top&&b[i][j]>b[i][s[top]])top--;
            if(top)r[i][j]=s[top]-1;else r[i][j]=n;
            s[++top]=j;
        }
        for(int j=1;j<=n;j++){
            A[l[i][j]][j]+=b[i][j];
            A[l[i][j]][r[i][j]+1]-=b[i][j];
            A[j+1][j]-=b[i][j];
            A[j+1][r[i][j]+1]+=b[i][j];
        }
    }
    ll ans=-1ll<<60;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++)A[i][j]+=A[i][j-1];
        for(int j=1;j<=n;j++)A[i][j]+=A[i-1][j];
        for(int j=i;j<=n;j++)ans=max(ans,A[i][j]-a[j]+a[i]);
    }
    printf("%lld",ans);
    return 0;
}
