#include using namespace std; #define ll long long #define vl vector #define vvl vector template inline int chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline int chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } auto _ = []() { ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }(); int main() { ll N, M; cin >> N >> M; vl A(N), B(N); for (auto& x : A) cin >> x; for (auto& x : B) cin >> x; ll ma = 0; for (int s = 0; s <= N - M; s++) { ll cur = 0; for (int i = 0; i < M; i++) cur += max(0LL, A[s + i] - B[s + i]); chmax(ma, cur); } cout << ma << "\n"; return 0; }