#include<bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n,c,a[N],r[N];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int ans = 0;
cin >> n >> c;
for(int i=1; i<=n; i++) cin >> r[i];
for(int i=1; i<=n; i++) cin >> a[i];
for(int i=1; i<=n; i++)
{
for(int j=1; j<=n; j++)
{
if(a[i] >= r[j] && r[j] != 0)
{
a[i] -= r[j];
r[j] = 0;
}
else if(r[j] >= a[i])
{
r[j] -= a[i];
a[i] = 0;
}
}
ans = ans+(a[i]*c);
}
cout << ans;
return 0;
}