#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
const int inf = 1e9 + 7;
int n, m;
int k;
int a[maxn];
int t[maxn];
int sum[maxn];
int s[maxn];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    sum[i] = sum[i - 1] + a[i];
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &t[i]);
    s[i] = s[i - 1] + a[i] * t[i];
  }
  int ans = s[n];
  for (int i = 1; i <= n - k + 1; ++i) {
    int le = i;
    int ri = i + k - 1;
    ans = max(ans, s[i - 1] + sum[ri] - sum[le - 1] + s[n] - s[ri]);
  }
  cout << ans << endl;
  return 0;
}
