#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;


template <typename T, typename Func>
class SegmentTree{
protected:
  const int depth, size, hsize;
  const T e;
  const Func f;
  std::vector<T> data;

public:
  SegmentTree(int n, const T &e, const Func &f):
    depth(n > 1 ? 32-__builtin_clz(n-1) + 1 : 1),
    size((1 << depth) - 1),
    hsize(size / 2 + 1),
    e(e),
    f(f),
    data(size + 1, e)
  {}

  inline T operator[](int i) const {
    return at(i);
  }
  
  inline T at(int i) const {
    return data[hsize + i];
  }

  inline T get(int x, int y) const { // [x,y)
    int l = x + hsize, r = y + hsize;
    T ret = e;

    // must be commutative
    while(l < r){
      if(r & 1) ret = f(ret, data[--r]);
      if(l & 1) ret = f(ret, data[l++]);
      l >>= 1, r >>= 1;
    }
    
    return ret;
  }

  inline void update(int i, const T &x){
    i += hsize;
    data[i] = x;
    while(i > 1){
      i >>= 1;
      data[i] = f(data[i << 1 | 0], data[i << 1 | 1]);
    }
  }

  inline void init(const T &val){
    data.assign(size + 1, e);
    for(int i = 0; i < hsize; ++i) data[hsize + i] = val;

    for(int i = hsize-1; i >= 1; --i){
      data[i] = f(data[i << 1 | 0], data[i << 1 | 1]);
    }
  }

  inline void init_with_vector(const std::vector<T> &val){
    data.assign(size + 1, e);
    for(int i = 0; i < (int)val.size(); ++i) data[hsize + i] = val[i];
    
    for(int i = hsize-1; i >= 1; --i){
      data[i] = f(data[i << 1 | 0], data[i << 1 | 1]);
    }
  }

  void debug(){
#ifdef DEBUG
    std::cerr << "{";
    for(int i = 0; i < hsize; ++i){
      if(i) std::cerr << ",";
      std::cerr << data[hsize + i];
    }
    std::cerr << "}" << std::endl;
#endif
  }
};



template <typename T, typename Func>
class SegmentTreeRangeArgmax : public SegmentTree<std::pair<T, int>, Func>{
  using super = SegmentTree<std::pair<T, int>, Func>;

public:
  SegmentTreeRangeArgmax(int n, const std::pair<T, int> &e, const Func &f): super(n, e, f){}

  inline void update(int i, const T &val){
    super::update(i, std::make_pair(val, i));
  }
};

template <typename T>
auto make_segment_tree_range_argmax(int size, const T &e){
  auto f =
    [](const auto &a, const auto &b){
      if(a.first == b.first){
        return std::make_pair(std::max(a.first, b.first), std::min(a.second, b.second));
      }else{
        return std::max(a, b);
      }
    };
  
  return SegmentTreeRangeArgmax<T, decltype(f)>(size, std::make_pair(e, INT_MAX), f);
}




template <typename T> struct Imos2D{
  std::vector<std::vector<T>> vec;
  int n, m;
  Imos2D(int n, int m): vec(n+1, std::vector<T>(m+1)), n(n), m(m){}

  void add(int a1, int b1, int a2, int b2, const T &val){ // [a1,a2) [b1,b2)
    vec[a1][b1] += val;
    vec[a2][b2] += val;
    vec[a1][b2] -= val;
    vec[a2][b1] -= val;
  }

  void calc(){
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < m+1; ++j){
        vec[i+1][j] += vec[i][j];
      }
    }

    for(int i = 0; i < n+1; ++i){
      for(int j = 0; j < m; ++j){
        vec[i][j+1] += vec[i][j];
      }
    }
  }

  inline const std::vector<T>& operator[](size_t i) const {return vec[i];}
};


template <typename F>
struct FixPoint : F{
  explicit constexpr FixPoint(F &&f) noexcept : F(std::forward<F>(f)){}

  template <typename... Args>
  constexpr decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};

template <typename F>
static inline constexpr decltype(auto) make_fix_point(F &&f){
  return FixPoint<F>(std::forward<F>(f));
}



int main(){
  int N, M;
  while(cin >> N >> M){
    vector<LLI> A(N-1); cin >> A;

    vector<LLI> S(N);
    REP(i,N-1) S[i+1] = S[i] + A[i];
    
    vector<vector<LLI>> B(N, vector<LLI>(M)); cin >> B;

    auto im = Imos2D<LLI>(N, N);

    LLI ans = 0;

    REP(k,M){
      auto seg = make_segment_tree_range_argmax(N, 0);
      REP(i,N) seg.update(i, B[i][k]);

      auto f =
        make_fix_point([&](auto &&f, int lb, int ub) -> void{
                         if(lb == ub) return;

                         auto p = seg.get(lb, ub);

                         im.add(lb, p.snd, p.snd+1, ub, p.fst);
                         
                         f(lb, p.snd);
                         f(p.snd+1, ub);
                       });
      
      f(0, N);
    }
    
    im.calc();

    REP(i,N){
      FOR(j,i,N){
        chmax(ans, im[i][j] - (S[j] - S[i]));
      }
    }

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 204032