#include using namespace std; using lint = long long; int main() { int n, m; cin >> n >> m; vector a(n), b(m), c(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]; } vector v(n); v[0] = a[0]; for (int i = 0; i < n - 1; i++) { v[i + 1] = v[i] + b[i % m]; } map> mp; for (int i = 0; i < n; i++) { mp[a[i] - v[i]].emplace_back(i); } lint ans = 1e18, sum = accumulate(c.begin(), c.end(), 0LL); for (auto [d, vec] : mp) { lint cur = sum; for (int x : vec) { cur -= c[x]; } ans = min(ans, cur); } cout << ans << endl; }