N, M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = [] for i in range(N): v = max(0, A[i] - B[i]) C.append(v) ans = 0 now = sum(C[:M]) ans = now for i in range(M, N): now -= C[i-M] now += C[i] ans = max(ans, now) print(ans)