#!/usr/bin/env python3 # -*- coding: utf-8-auto -*- N, M = map(int, input().split()) A_list = list(map(int, input().split())) B_list = list(map(int, input().split())) temp_list = [max(x[0]-x[1],0) for x in zip(A_list, B_list)] temp = sum(temp_list[:M]) max_value = temp for i in range(N-M+1): if i == 0: continue # print(i, i+M-1) # print(temp_list[i:i+M]) temp = temp - temp_list[i-1] + temp_list[i+M-1] max_value = max(max_value, temp) print(max_value)