#include <stdio.h>
#include <algorithm>

int n,m;

int times(int A, int B, int C, int target)
{
    //printf("%d:%d:%d\n", A, B, C);
    if( B & 1 )
        return times(A>>1, B>>1, C>>1, -target) + 1 + times((A|B|C)>>1, 0, 0, 1);
        //return std::min(times(A>>1,B>>1,C>>1,-1), times(A>>1,B>>1,C>>1,1)) + 1 + times(((A|B|C)>>1) , 0, 0, 1);
    if( A & 1 )
        if( target == -1 )
            return times(A>>1, B>>1, C>>1, -1);
        else
            return times(A>>1, B>>1, C>>1, 1) + 1 + times(0, 0, ((A|B|C)>>1) , -1) + 1 + times(((A|B|C)>>1) , 0, 0, 1);
    if( C & 1 )
        if( target == 1 )
            return times(A>>1, B>>1, C>>1, 1);
        else
            return times(A>>1, B>>1, C>>1, -1) + 1 + times(((A|B|C)>>1), 0, 0, 1) + 1 + times(0, 0, ((A|B|C)>>1), -1);
    return 0;
}



int main(void)
{
    while(true)
    {
        int cups[3] = {0,0,0};

        scanf("%d%d",&n,&m);
        if(!n && !m) break;

        for(int i=0; i < 3; i++)
        {
            int c;
            scanf("%d", &c);
            for(int j=0; j < c; j++)
            {
                int t;
                scanf("%d", &t);
                cups[i] |= 1<<(t-1);
            }
        }

        int res = std::min(times(cups[0], cups[1], cups[2], -1), times(cups[0], cups[1], cups[2],  1));
        printf("%d\n", res <= m ? res : -1);
    }

    return 0;
}