#include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();     return x * f;   }   int n, m, f[4005][4005], l[4005], s[4005], c[4005];   int main() {     n = read(), m = read() + n;     for (int i = n; i >= 1; --i) l[i] = read();     for (int i = n; i >= 1; --i) s[i] = read();     for (int i = 1; i <= m; ++i) c[i] = read();     memset(f, -0x3f, sizeof(f));     for (int i = 0; i <= m; ++i) f[i][0] = 0;     for (int i = 1; i <= n; ++i) {       for (int j = n; j >= 1; --j)         f[l[i]][j] = max(f[l[i]][j], f[l[i]][j - 1] + c[l[i]] - s[i]);       for (int j = l[i]; j < m; ++j) {         for (int k = 0; k <= (n >> j - l[i]); ++k) {           f[j + 1][k / 2] = max(f[j + 1][k / 2], f[j][k] + k / 2 * c[j + 1]);         }       }     }     cout << f[m][0];     return 0;   }   