#include <bits/stdc++.h>
using namespace std;
int n, k, ans, cur, a[100005], s[100005], t[100005], x;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    cur += x * a[i];
    s[i] = s[i - 1] + x * a[i];
    t[i] = t[i - 1] + a[i];
  }
  ans = cur;
  for (int i = k; i <= n; i++) {
    int tmp = cur + t[i] - t[i - k] - s[i] + s[i - k];
    if (tmp > ans) ans = tmp;
  }
  printf("%d", ans);
  return 0;
}
