from collections import deque N, M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = [] for a, b in zip(A, B): C.append(max(0, a - b)) ans = 0 que = deque() total = 0 for i in range(N): c = C[i] que.append(c) total += c if len(que) > M: rm = que.popleft() total -= rm if i >= M - 1: if total > ans: ans = total print(ans)