#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  ll sm = 0;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sm += a[i];
  }
  multiset<int> s;
  for (int& e : b) cin >> e, s.insert(e);
  ll ans = max(0, a[n - 1] - b[n - 1]);
  if (k == 0) {
    for (int i = 0; i < n - 1; i++) {
      ans = max(ans, sm - b[i]);
      sm -= a[i];
    }
  } else if (k == 1) {
    for (int i = 1; i < n; i++) ans = max(ans, sm - a[i] - b[0]);
    ll suf = sm - a[0];
    for (int i = 1; i < n - 1; i++) {
      ans = max(ans, max(sm - a[n - 1], suf) - b[i]);
      suf -= a[i];
    }
    ans = max(ans, sm - *s.begin() - *next(s.begin()));
  } else {
    int mn = 1e9;
    for (int i = 0; i < n - 1; i++) mn = min(mn, b[i]);
    ans = max(ans, sm - mn);
  }
  cout << ans << "\n";
}
