#include <bits/extc++.h>
#define endl '\n'
typedef long long ll;
#define int ll
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;
void Main()
{
int n, k;
cin >> n >> k;
vector<int> p(n);
for (int& x : p)
{
cin >> x;
}
vector<int> w(n);
for (int& x : w)
{
cin >> x;
}
vector<pair<int, int>> a(n);
for (auto [aa, pp, ww] : views::zip(a, p, w))
{
aa = {pp, ww};
}
ranges::sort(a);
int res = -1;
for (int i = 0; i < n; ++i)
{
const int tg = a[i].first;
vector<int> cst;
for (int j = 0; j < n; ++j)
{
if (a[j].first <= tg)
{
cst.push_back((tg - a[j].first) * a[j].second);
}
}
if (static_cast<int>(cst.size()) < k)
{
continue;
}
ranges::sort(cst);
int cur = 0;
for (int j = 0; j < k; ++j)
{
cur += cst[j];
}
if (res == -1 || cur < res)
{
res = cur;
}
}
cout << res << endl;
}
// #define CP_MULTI_TEST_CASES
signed main()
{
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int t = 1;
#ifdef CP_MULTI_TEST_CASES
cin >> t;
#endif
while (t--)
{
Main();
}
return cout << flush, fflush(stdout), 0;
}