#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, m; cin >> n >> m;
    vector<vector<int>> v(n, vector<int>(m));
    ll sum1 = 0, sum2 = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> v[i][j];
        }
    }
    if (n == 2)
    {
        vector<int> a(m);
        for (int i = 0; i < m; i++)
        {
            a[i] = v[0][i] - v[1][i];
        }
        ll curr = 0;
        ll best = INT_MIN;
        for (int i = 0; i < m; i++)
        {
            curr += a[i];
            best = max(best, curr);
        }
        cout << best << endl;
    }
}