Aquarium decoration

Arkady and Masha want to choose decorations for thier aquarium in Fishdom game. They have n decorations to choose from, each of them has some cost. To complete a task Arkady and Masha need to choose exactly m decorations from given, and they want to spend as little money as possible.

There is one difficulty: Masha likes some a of the given decorations, Arkady likes some b of the given decorations. Some decorations may be liked by both Arkady and Masha, or not be liked by both. The friends want to choose such decorations so that each of them likes at least k decorations among the chosen. Help Masha and Arkady find the minimum sum of money they need to spend.

Input

The first line contains three integers nm and k (1 ≤ n ≤ 200000, 1 ≤ m ≤ n, 1 ≤ k ≤ n) — the number of decorations, how many decorations the friends should choose, how many decorations each of them should like among the chosen.

The second line contains n integers c 1, c 2, …, c n (1 ≤ c i ≤ 109) — decorations costs.

The third line contains single integer a (1 ≤ a ≤ n) — the number of decorations liked by Masha. The fourth line contains a distinct integers x 1, x 2, …, x a (1 ≤ x i ≤ n) — the ids of decorations liked by Masha.

The next two lines describe decorations liked by Arkady in the same format.

Output

Print single integer: the minimum sum of money the friends should spend to fulfill all constraints. If it is not possible, print -1.

Examples

input

4 3 2
3 2 2 1
2
1 2
2
1 3

output

7

input

4 3 2
3 2 2 1
2
1 2
3
4 1 3

output

6

input

4 2 2
3 2 2 1
2
1 2
3
4 1 3

output

-1

Note

In the first example the only possible variant to choose 3 decorations having all conditions satisfied is to choose decorations 1, 2, 3.

In the second example friends can choose decoration 4 instead of decoration 3, because this one is one coin cheaper.

In the third example it’s not possible to choose 2 decorations in a way that both are liked by both Masha and Arkady.

Solution:

#include <bits/stdc++.h>

using namespace std;

const long long inf = (long long) 1e18;
const int infint = (int) 2e9;

const int N = 1234567;

int c[N];
int mask[N];

vector  <int> s[4];
int ptr[4];
int num[4];

int main() {
int n, m, k;
scanf("%d %d %d", &n, &m, &k);
if (k > m) {
puts("-1");
return 0;
}
for (int i = 0; i < n; i++) {
    scanf("%d", c + i);
    mask[i] = 0;
  }
  for (int t = 0; t < 2; t++) {
    int foo;
    scanf("%d", &foo);
    while (foo--) {
      int bar;
      scanf("%d", &bar);
      bar--;
      mask[bar] |= (1 << t);
    }
  }
  for (int i = 0; i < n; i++) {
    s[mask[i]].push_back(c[i]);
  }
  for (int t = 0; t < 4; t++) {
    sort(s[t].begin(), s[t].end());
  }
  ptr[3] = s[3].size();
  long long ans = inf;
  long long cur = 0;
  for (int z : s[3]) {
    cur += z;
  }
  for (int j = 0; j < 3; j++) {
    ptr[j] = 0;
  }
  for (int both = m; both >= 0; both--) {
while (ptr[3] > both) {
cur -= s[3][--ptr[3]];
}
while (ptr[0] + ptr[1] + ptr[2] < m - both) {
      int best = infint;
      int best_j = -1;
      for (int j = 0; j < 3; j++) {
        num[j] = (ptr[j] == (int) s[j].size() ? infint : s[j][ptr[j]]);
        if (num[j] < best) {
          best = num[j];
          best_j = j;
        }
      }
      if (best_j == -1) {
        break;
      }
      cur += s[best_j][ptr[best_j]++];
    }
    for (int t = 1; t <= 2; t++) {
      while (ptr[t] < k - both && ptr[t] != (int) s[t].size()) {
        if (ptr[0] == 0 && ptr[3 - t] <= k - both) {
          break;
        }
        if (ptr[3 - t] <= k - both || (ptr[0] != 0 && s[0][ptr[0] - 1] > s[3 - t][ptr[3 - t] - 1])) {
cur -= s[0][--ptr[0]];
} else {
cur -= s[3 - t][--ptr[3 - t]];
}
cur += s[t][ptr[t]++];
}
}
if (ptr[3] == both && ptr[1] + ptr[3] >= k && ptr[2] + ptr[3] >= k && ptr[0] + ptr[1] + ptr[2] + ptr[3] == m) {
ans = min(ans, cur);
}
}
cout << (ans == inf ? -1LL : ans) << endl;
  return 0;
}