func_code_string: #include <bits/stdc++.h>   using namespace std;   long long read() {     long long x = 0, f = 1;     char ch;     while (!isdigit(ch = getchar())) (ch ==  - ) && (f = -f);     for (x = ch ^ 48; isdigit(ch = getchar());          x = (x << 3) + (x << 1) + (ch ^ 48))       ;     return x * f;   }   const long long N = 2e5 + 66;   long long n, m, k, A, B, C, AB, tmp1, tmp2, a[N], b[N], tag[N], taga[N],       tagb[N], tagab[N];   long long n1[N], n2[N], n3[N];   long long suma[N], sumb[N], sumc[N], sum, ans;   bool visa[N], visb[N];   struct seg {     long long a, b, c;   } tr[N << 2];   void up(long long o) {     tr[o].a = tr[(o << 1 | 1)].a;     tr[o].b = tr[(o << 1 | 1)].b;     tr[o].c = tr[(o << 1 | 1)].c;   }   void build(long long o, long long l, long long r) {     if (l == r) {       tr[o].a = n1[l];       tr[o].b = n2[l];       tr[o].c = n3[l];       return;     }     build((o << 1), l, ((l + r) >> 1));     build((o << 1 | 1), ((l + r) >> 1) + 1, r);     up(o);   }   long long query(long long o, long long l, long long r, long long a) {     if (l == r)       return suma[max(tr[o].a, a)] + sumb[max(tr[o].b, a)] + sumc[tr[o].c] -              b[l] * (max(tr[o].a, a) + max(tr[o].b, a) + tr[o].c + k - a - m);     long long t =         max(tr[(o << 1)].a, a) + max(tr[(o << 1)].b, a) + tr[(o << 1)].c + k - a;     if (t >= m)       return query((o << 1), l, ((l + r) >> 1), a);     else       return query((o << 1 | 1), ((l + r) >> 1) + 1, r, a);   }   signed main() {     n = read();     m = read();     k = read();     for (long long i = 1; i <= n; i++) a[i] = read(), b[i] = a[i];     sort(b + 1, b + 1 + n);     long long cur = unique(b + 1, b + 1 + n) - b - 1;     for (long long i = 1; i <= n; i++)       a[i] = lower_bound(b + 1, b + 1 + cur, a[i]) - b;     tmp1 = read();     for (long long i = 1; i <= tmp1; i++) visa[read()] = 1;     tmp2 = read();     for (long long i = 1; i <= tmp2; i++) visb[read()] = 1;     for (long long i = 1; i <= n; i++) {       if (visa[i] && visb[i])         tagab[++AB] = b[a[i]];       else if (visa[i])         taga[++A] = b[a[i]], n1[a[i]]++;       else if (visb[i])         tagb[++B] = b[a[i]], n2[a[i]]++;       else         tag[++C] = b[a[i]], n3[a[i]]++;     }     if (k > m || (AB + A < k) || (AB + B < k)) {       puts( -1 );       return 0;     }     sort(tagab + 1, tagab + 1 + AB);     sort(taga + 1, taga + 1 + A);     sort(tagb + 1, tagb + 1 + B);     sort(tag + 1, tag + 1 + C);     for (long long i = 1; i <= cur; i++)       n1[i] += n1[i - 1], n2[i] += n2[i - 1], n3[i] += n3[i - 1];     for (long long i = 1; i <= A; i++) suma[i] = suma[i - 1] + taga[i];     for (long long i = 1; i <= B; i++) sumb[i] = sumb[i - 1] + tagb[i];     for (long long i = 1; i <= C; i++) sumc[i] = sumc[i - 1] + tag[i];     build(1, 0, cur);     sum = 0;     ans = 1ll << 60;     for (long long i = 0, tmp; i <= min(AB, m); i++) {       sum += tagab[i];       if (min(A, B) >= k - i && 2 * k - i <= m && i + A + B + C >= m)         ans = min(ans, sum + (tmp = query(1, 0, cur, k - i)));     }     if (ans == (1ll << 60))       puts( -1 );     else       printf( %lld n , ans);     return 0;   }   