#include <iostream>
#include <algorithm>
using namespace std;

int n, m;

int solve(int A, int B, int C){
	if( !A && !B ) return 0;
	if( C & 1 ) return solve(A >> 1, B >> 1, C >> 1);
	if( B & 1 ) return solve(C >> 1, B >> 1, A >> 1) + solve((A|B|C) >> 1, 0, 0) + 1;
	if( A & 1 ) return solve(A >> 1, B >> 1, C >> 1) + 2 * solve((A|B|C) >> 1, 0, 0) + 2;
}

int main(){
	while( cin >> n >> m , n || m ){
		int cup[3] = {0};
		for(int i=0 ; i < 3 ; i++ ){
			int k, e;
			cin >> k;
			for(int j=0 ; j < k ; j++ ){
				cin >> e;
				cup[i] |= 1 << e - 1;
			}
		}
		int ans = min(solve(cup[0], cup[1], cup[2]), solve(cup[2], cup[1], cup[0]));
		if( m < ans ) ans = -1;
		cout << ans << endl;
	}
}