#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  vector<int> t(n);
  vector<int> sum1(n + 1, 0);
  vector<int> sum2(n + 1, 0);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum1[i + 1] = sum1[i] + a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
    sum2[i + 1] = sum2[i] + (t[i] * a[i]);
  }
  int ans = 0;
  for (int i = 0; i <= n - k; ++i) {
    ans = max(ans, sum2[n] - (sum2[i + k] - sum2[i]) + (sum1[i + k] - sum1[i]));
  }
  cout << ans << endl;
}
