#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAX_N = 5005, MAX_M = 205;
typedef long long i64;

int N, M, B[MAX_N][MAX_M];
i64 d[MAX_N], sum[MAX_N], value[MAX_N];
int q[MAX_M][MAX_N], top[MAX_M];

int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i < N; ++i) {
    scanf("%lld", &d[i + 1]);
    d[i + 1] += d[i];
  }
  
  for (int i = 1; i <= N; ++i) value[i] = d[i];
  
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j)
      scanf("%d", &B[i][j]);

  i64 result = 0;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= i; ++j) sum[j] = 0;
    for (int j = 1; j <= M; ++j) {
      int &t = top[j], *st = q[j];
      value[i] += B[i][j];
      while (t > 0 && B[st[t]][j] <= B[i][j]) {
	sum[st[t]] += B[i][j] - B[st[t]][j];
	sum[st[t - 1]] -= B[i][j] - B[st[t]][j];
	t--;
      }
      st[++t] = i;
    }
    for (int j = i; j; --j) {
      sum[j] += sum[j + 1];
      value[j] += sum[j];
      result = max(result, value[j] - d[i]);
    }
  }

  printf("%lld\n", result);
  return 0;
}
