#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; int main() { int N, M; cin >> N >> M; vector A(N), B(M), C(N), sum(N); for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < M; i++) cin >> B[i]; for (int i = 0; i < N; i++) cin >> C[i]; for (int i = 0; i < N - 1; i++) sum[i + 1] = sum[i] + B[i % M]; ll cost_all = 0; for (int i = 0; i < N; i++) cost_all += C[i]; map mp; for (int i = 0; i < N; i++) mp[A[i] - sum[i]] += C[i]; ll ans = cost_all; for (auto p: mp) ans = min(ans, cost_all - p.second); cout << ans << endl; return 0; }