#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    vec<ll> A(N+1);
    for(int i=2;i<=N;i++){
        cin >> A[i];
        A[i] += A[i-1];
    }
    vvec<ll> B(M+1,vec<ll>(N+1,0));
    for(int i=1;i<=N;i++) for(int j=1;j<=M;j++) cin >> B[j][i];
    vvec<ll> S(N+2,vec<ll>(N+2,0));
    
    auto imos = [&](vec<ll>& b){
        set<int> s;
        s.insert(0);
        s.insert(N+1);
        vec<int> id(N);
        iota(id.begin(),id.end(),1);
        sort(id.begin(),id.end(),[&](int i,int j){return b[i]>b[j];});
        for(auto i:id){
            set<int>::iterator itl = s.upper_bound(i);
            int r = *itl;
            itl--;
            int l = *itl;
            r--; l++;
            S[l][i] += b[i];
            S[l][r+1] -= b[i];
            S[i+1][i] -= b[i];
            S[i+1][r+1] += b[i];
            s.insert(i);     
        }
    };
    
    for(int j=1;j<=M;j++) imos(B[j]);

    for(int i=1;i<=N;i++) for(int j=1;j<=N;j++) S[i][j] += S[i-1][j];
    for(int i=1;i<=N;i++) for(int j=1;j<=N;j++) S[i][j] += S[i][j-1];

    ll ans = 0;
    for(int i=1;i<=N;i++) for(int j=i;j<=N;j++) ans = max(ans,S[i][j]-A[j]+A[i]);
    cout << ans << endl;
}