N, M = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = 0 SUM = 0 for i in range(N-M+1): if i == 0: for j in range(M): SUM += max(A[j]-B[j], 0) else: SUM -= max(A[i-1]-B[i-1], 0) SUM += max(A[i+M-1]-B[i+M-1], 0) ans = max(ans, SUM) print(ans)