Problem: E: Red Black Balloons

Story

Homura-chan's dream comes true. It means ICPC Asia regional contest 20xx will be held in Sapporo! Homura-chan has been working hard for the preparation. And finally, it's the previous day of the contest. Homura-chan started to stock balloons to be delivered to contestants who get accepted. However, she noticed that there were only two colors of balloons: red and black.

Problem Statement

ICPC Asia regional contest in Sapporo plans to provide N problems to contestants. Homura-chan is a professional of contest preparation, so she already knows how many contestants would get acceptance for each problem (!!), a_i contestants for the i-th problem. You can assume the prediction is perfectly accurate. Ideally, Homura-chan would assign a distinct color of a balloon to each problem respectively. But you know, she has only two colors red and black now. Thus, Homura-chan comes up with the idea to differentiate the size of balloons in K levels, that is, each problem has a balloon with a distinct pair of (color, size).

Homura-chan now has r_i red balloons with size i (1 \leq i \leq K) and b_j black balloons with size j (1 \leq j \leq K). Suppose we assign a pair (c_i, s_i) of a color c_i (red or black) and a size s_i to the i-th problem, for each i. As noted, we have to assign distinct pairs to each problem, more precisely, (c_i, s_i) \neq (c_j, s_j) holds for i \neq j. Moreover, the number of balloons with (c_i, s_i) must be no less than a_i. In the case that there are no such assignments, Homura-chan can change the size of balloons by her magic power. Note that Homura-chan doesn't know magic to change the color of balloons, so it's impossible.

Your task is to write a program computing the minimum number of balloons whose size is changed by Homura-chan's magic to realize an assignment satisfying the above-mentioned conditions. If there is no way to achieve such an assignment even if Homura-chan changes the size of balloons infinitely, output `-1` instead.

Input


N K
a_1 ... a_N
r_1 ... r_K
b_1 ... b_K


Constraints

* 1 \leq N,K \leq 60
* N \leq 2K
* 1 \leq a_i \leq 50 (1 \leq i \leq N)
* 1 \leq r_j,b_j \leq 50 (1 \leq j \leq K)
* Inputs consist only of integers.



Output

Output the minimum number of balloons whose size is changed to achieve an assignment in a line. If there are no ways to achieve assignments, output `-1` instead.

Sample Input 1


3 2
6 5 4
8 1
7 1


Output for Sample Input 1


3

Homura-chan changes the size of three red balloons from 1 to 2. Then she can assign (black,1) to the problem 1, (red,1) to the problem 2, and (red,2) to the problem 3.

Sample Input 2


2 1
50 50
2
3


Output for Sample Input 2


-1

Sample Input 3


4 3
3 10 28 43
40 18 2
26 7 11


Output for Sample Input 3


5





Example

Input

3 2
6 5 4
8 1
7 1


Output

3

Solution (in CPP):

Solution:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define m_p make_pair
#define sz(x) (int)x.size()
#define out(x) cerr<<#x<<" = "<<x<<" "
#define outln(x) cerr<<#x<<" = "<<x<<endl
#define outarr(x,l,r) cerr<<#x"["<<l<<"-"<<r<<"] = "; for (int _i=l;_i<=r;++_i) cerr<<x[_i]<<" ";cerr<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
#define gc() getchar()
//char buf[1<<23],*p1=buf,*p2=buf;
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <class T> void read(T &x)
{
    x=0; char c=gc(); int flag=0;
    while (c<'0'||c>'9') flag|=(c=='-'),c=gc();
    while (c>='0'&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=gc();
    if (flag) x=-x;
}
template <class T> T _max(T a,T b){return a>b ? a : b;}
template <class T> T _min(T a,T b){return a<b ? a : b;}
template <class T> bool checkmax(T &a,T b){return b>a ? a=b,1 : 0;}
template <class T> bool checkmin(T &a,T b){return b<a ? a=b,1 : 0;}
const int N=200005,inf=0x3f3f3f3f;
int n,k;
int a[N],r[N],b[N];
int suma[N],sumb,sumr;
void init()
{
	read(n); read(k);
	for (int i=1;i<=n;++i)
	{
		read(a[i]);
	}
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	for (int i=1;i<=k;++i)
	{
		read(r[i]);
	}
	sort(r+1,r+k+1);
	reverse(r+1,r+k+1);
	for (int i=1;i<=k;++i)
	{
		read(b[i]);
	}
	sort(b+1,b+k+1);
	reverse(b+1,b+k+1);
	for (int i=1;i<=n;++i)
	{
		suma[i]=suma[i-1]+a[i];
		sumb+=b[i];
		sumr+=r[i];
	}
}

int dp[62][62][3005];
void solve()
{
	int ans=inf;
	memset(dp,-1,sizeof dp);
	dp[0][0][0]=0;
	//outarr(a,1,n);
	for (int i=0;i<=k;++i)
	{
		for (int j=0;j<=k&&i+j<=n;++j)
		{
			for (int sum=0;sum<=suma[i+j];++sum)
			{
				if (dp[i][j][sum]==-1) continue;
				//out(i); out(j); out(sum); outln(dp[i][j][sum]);
				if (n==i+j)
				{
					if (sumr>=sum&&sumb>=suma[n]-sum)
					{
						//out(i); out(j); out(sum); outln(suma[n]-sum);
						checkmin(ans,suma[n]-dp[i][j][sum]);
					}
					continue;
				}
				if (i<k)
				{
					int new_sum=sum+a[i+j+1];
					checkmax(dp[i+1][j][new_sum],dp[i][j][sum]+_min(r[i+1],a[i+j+1]));
				}
				if (j<k)
				{
					int new_sum=sum;
					checkmax(dp[i][j+1][new_sum],dp[i][j][sum]+_min(b[j+1],a[i+j+1]));
				}
			}
		}
	}
	if (ans==inf) ans=-1;
	printf("%d\n",ans);
}

#undef int
int main()
{
	init();
	solve();
    return 0;
}