#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int n, k;
vector<int> v1, v2;
struct node {
  int t;
  int a;
  int b;
} f[MAXN];
bool cmp(node x, node y) {
  if (x.t != y.t)
    return x.t < y.t;
  else
    return x.a + x.b > y.a + y.b;
}
int main() {
  scanf("%d%d", &n, &k);
  int x = 0;
  int y = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &f[i].t);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &f[i].a);
    x += f[i].a;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &f[i].b);
    y += f[i].b;
  }
  if (x < k || y < k) {
    printf("-1\n");
    return 0;
  }
  sort(f + 1, f + 1 + n, cmp);
  x = 0;
  y = 0;
  int pos;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    x += f[i].a;
    y += f[i].b;
    if (f[i].a == 1 && f[i].b == 0)
      v1.push_back(f[i].t);
    else if (f[i].a == 0 && f[i].b == 1)
      v2.push_back(f[i].t);
    if (f[i].a == 0 && f[i].b == 0)
      continue;
    else
      ans += f[i].t;
    if (x >= k && y >= k) {
      pos = i;
      break;
    }
  }
  int pos1 = v1.size() - 1;
  int pos2 = v2.size() - 1;
  if (pos1 < 0 || pos2 < 0) {
    printf("%lld\n", ans);
    return 0;
  }
  for (int i = pos + 1; i <= n; i++) {
    if (f[i].a == 1 && f[i].b == 1) {
      if (f[i].t < v1[pos1] + v2[pos2]) {
        ans = ans + f[i].t - v1[pos1] - v2[pos2];
        pos1--;
        pos2--;
      } else {
        break;
      }
    }
    if (pos1 < 0 || pos2 < 0) break;
  }
  printf("%lld\n", ans);
}
