#include <iostream>
#include <algorithm>
#include <utility>
#include <numeric>
#include <vector>
#include <array>
#include <queue>

template <class T, class U>
inline bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) { lhs = rhs; return true; }
  return false;
}

template <class T, class U>
inline bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) { lhs = rhs; return true; }
  return false;
}

template <class T>
class disjoint_sparse_table {
public:
  using value_type = typename T::value_type;
  const typename T::value_operation op = typename T::value_operation();

private:
  std::vector<std::vector<value_type>> table;

public: 
  disjoint_sparse_table() = default;
  disjoint_sparse_table(const std::vector<value_type> &table_) { build(table_); }

  void build(const std::vector<value_type> &table_) {
    int height = 0, size = table_.size();
    while ((1 << height) < size) ++height;
    if (size == 1) ++height;
    table.assign(height, std::vector<value_type>(size));
    for (int i = 0; i < size; ++i) {
      table[0][i] = table_[i];
    }
    for (int i = 1; i < height; ++i) {
      int bit = (1 << i);
      for (int l = 0; l < size; l += (bit << 1)) {
        int m = (l + bit < size ? l + bit : size);
        table[i][m - 1] = table_[m - 1];
        for (int j = m - 2; j >= l; --j) {
          table[i][j] = op(table_[j], table[i][j + 1]);
        }
        if (m >= size) continue;
        int r = (m + bit < size ? m + bit : size);
        table[i][m] = table_[m];
        for (int j = m + 1; j < r; ++j) {
          table[i][j] = op(table[i][j - 1], table_[j]);
        }
      }
    }
  }

  value_type fold(int l, int r) const {
    if (l >= --r) return table[0][l];
    int h = 31 - __builtin_clz(l ^ r);
    return op(table[h][l], table[h][r]);
  }

};

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

constexpr i32 inf32 = (i32(1) << 30) - 1;
constexpr i64 inf64 = (i64(1) << 62) - 1;

struct range_max {
  using value_type = i64;
  struct value_operation {
    value_type operator () (const value_type &x, const value_type &y) const {
      return std::max(x, y);
    }
  };
};

int main() {
  size_t N, M;
  std::cin >> N >> M;
  std::vector<i64> A(N);
  for (size_t i = 1; i < N; ++i) {
    std::cin >> A[i];
    A[i] += A[i - 1];
  }
  std::vector<std::vector<i64>> B_impl(M, std::vector<i64>(N));
  for (size_t i = 0; i < N; ++i) {
    for (size_t j = 0; j < M; ++j) {
      std::cin >> B_impl[j][i];
    }
  }
  std::vector<disjoint_sparse_table<range_max>> B(M);
  for (size_t i = 0; i < M; ++i) {
    B[i].build(B_impl[i]);
  }
  struct query { size_t l, r, d, u; };
  std::queue<query> que;
  que.push(query{ 0, N, 0, N - 1 });
  i64 ans = -inf64;
  while (!que.empty()) {
    auto q = que.front();
    que.pop();
    size_t ml = (q.l + q.r) / 2;
    i64 max = -inf64;
    size_t mr = ml;
    for (size_t i = std::max(ml, q.d); i <= q.u; ++i) {
      i64 sum = A[ml] - A[i];
      for (size_t j = 0; j < M; ++j) {
        sum += B[j].fold(ml, i + 1);
      }
      if (chmax(max, sum)) {
        mr = i;
      }
    }
    chmax(ans, max);
    if (q.r - q.l > 1) {
      que.push(query{ q.l, ml, q.d, mr });
      que.push(query{ ml, q.r, mr, q.u });
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 109952