#include <bits/stdc++.h>
using namespace std;
int n, k;
long long a[100005], d[100005];
long long pref[100005], suff[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  long long total = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pref[i] = pref[i - 1] + a[i];
    total += a[i];
  }
  for (int i = n; i >= 1; i--) {
    suff[i] = suff[i + 1] + a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
  }
  if (k == 0) {
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      ans = max(ans, suff[i] - d[i]);
    }
    cout << ans << '\n';
  } else if (k >= 2) {
    long long ans = max(0LL, a[n] - d[n]);
    for (int i = 1; i < n; i++) {
      ans = max(ans, total - d[i]);
    }
    cout << ans << '\n';
  } else {
    long long ans = max(0LL, a[n] - d[n]);
    for (int i = 1; i < n; i++) {
      if (i > 1) ans = max(ans, suff[i] - d[i]);
      ans = max(ans, total - a[n] - d[i]);
    }
    for (int i = 1; i < n - 1; i++) {
      ans = max(ans, pref[i] + suff[i + 2] - d[1]);
    }
    long long mn = INT_MAX;
    for (int i = 1; i < n; i++) {
      mn = min(mn, d[i]);
      ans = max(ans, total - mn - d[i + 1]);
    }
    cout << ans << '\n';
  }
  return 0;
}
