/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>
#include<iomanip>

//
// Created by DALT on 12/9/2019.
//

#ifndef JHELPER_EXAMPLE_PROJECT_COMMON_H
#define JHELPER_EXAMPLE_PROJECT_COMMON_H

#include <bits/stdc++.h>
#include <chrono>
#include <random>

using std::deque;
using std::endl;
using std::map;
using std::max;
using std::min;
using std::pair;
using std::set;
using std::swap;
using std::vector;
using std::ios_base;
using std::ostream;
using std::istream;
using std::string;
using std::fill;
using std::sort;
using std::numeric_limits;
using std::make_pair;
using std::priority_queue;
using std::iterator;

typedef unsigned int ui;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());

#endif //JHELPER_EXAMPLE_PROJECT_COMMON_H

//
// Created by DALT on 12/15/2019.
//

#ifndef JHELPER_EXAMPLE_PROJECT_PRESUM_H
#define JHELPER_EXAMPLE_PROJECT_PRESUM_H



namespace dalt {
    template<typename T>
    class presum {
    public:
        presum(int cap) : _vec(cap) {
        }

        presum() {
        }

        presum(const presum<T> &vec) : _vec(vec._vec), _n(vec._n) {
        }

        void populate(vector<T> vec) {
            _vec.begin();
            _vec.clear();
            _vec.insert(_vec.end(), vec.begin(), vec.end());
            _n = _vec.size();
            for (int i = 1; i < _n; i++) {
                _vec[i] += _vec[i - 1];
            }
        };

        T interval(int l, int r){
            if(l > r){
                return 0;
            }
            T ans = _vec[r];
            if(l > 0){
                ans -= _vec[l - 1];
            }
            return ans;
        }
    private:
        vector<T> _vec;
        int _n;
    };
}

#endif //JHELPER_EXAMPLE_PROJECT_PRESUM_H

//
// Created by daltao on 2019/12/16.
//

#ifndef JHELPER_EXAMPLE_PROJECT_DEBUG_H
#define JHELPER_EXAMPLE_PROJECT_DEBUG_H

#endif //JHELPER_EXAMPLE_PROJECT_DEBUG_H


using namespace dalt;

vector<ll> as;
vector<vector<int>> bs;
vector<int> head;
vector<int> tail;
deque<int> deq;
vector<vector<ll>> intervals;
presum<ll> ps;


class arc067_d {
public:

    void solve(std::istream &in, std::ostream &out) {
        int n, m;
        in >> n >> m;
        as.resize(n - 1);
        bs.resize(n, vector<int>(m));
        head.resize(n);
        tail.resize(n);
        intervals.resize(n, vector<ll>(n));

        for (int i = 0; i < n - 1; i++) {
            in >> as[i];
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                in >> bs[i][j];
            }
        }

        for (int i = 0; i < m; i++) {
            deq.clear();
            for (int j = 0; j < n; j++) {
                while (!deq.empty() && bs[deq.back()][i] <= bs[j][i]) {
                    tail[deq.back()] = j - 1;
                    deq.pop_back();
                }
                deq.push_back(j);
            }
            while (!deq.empty()) {
                tail[deq.back()] = n - 1;
                deq.pop_back();
            }
            deq.clear();
            for (int j = n - 1; j >= 0; j--) {
                while (!deq.empty() && bs[deq.front()][i] <= bs[j][i]) {
                    head[deq.front()] = j + 1;
                    deq.pop_front();
                }
                deq.push_front(j);
            }
            while (!deq.empty()) {
                head[deq.front()] = 0;
                deq.pop_front();
            }

            for (int j = 0; j < n; j++) {
                intervals[head[j]][tail[j]] += bs[j][i];
                if (head[j] < j) {
                    intervals[head[j]][j - 1] -= bs[j][i];
                }
                if (tail[j] > j) {
                    intervals[j + 1][tail[j]] -= bs[j][i];
                }
                //std::cerr << j << "=(" << head[j] << ", " << tail[j] << ")" << endl;
            }
        }

        ps.populate(as);
        for (int i = 0; i < n; i++) {
            for (int j = n - 1; j >= i; j--) {
                if (i - 1 >= 0) {
                    intervals[i][j] += intervals[i - 1][j];
                }
                if (j + 1 <= n - 1) {
                    intervals[i][j] += intervals[i][j + 1];
                }
                if (i - 1 >= 0 && j + 1 <= n - 1) {
                    intervals[i][j] -= intervals[i - 1][j + 1];
                }
            }
        }

        ll ans = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                ll s = intervals[i][j] - ps.interval(i, j - 1);
                ans = max(ans, s);
            }
        }

        out << ans;

    }

private:
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
	std::cout << std::setiosflags(std::ios::fixed);
	std::cout << std::setprecision(15);

	arc067_d solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 202112