n,m=map(int,input().split())
g=(1<<n)

dp=[float("inf")]*g
dp[0]=0
for i in range(m):
    a,b=map(int,input().split())
    c_l=list(map(int,input().split()))
    f=0
    for c_i in c_l:
        f+=1<<(c_i-1)
    for j in range(g-1, -1, -1):
        dp[j|f]=min(dp[j]+a, dp[j|f])

print(-1 if dp[-1]==float("inf") else dp[-1]) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m g=(1<<n) g 1<<n 1 n dp=[float("inf")]*g dp [float("inf")]*g [float("inf")] float("inf") float "inf" g dp[0]=0 dp[0] dp 0 0 for i in range(m):
    a,b=map(int,input().split())
    c_l=list(map(int,input().split()))
    f=0
    for c_i in c_l:
        f+=1<<(c_i-1)
    for j in range(g-1, -1, -1):
        dp[j|f]=min(dp[j]+a, dp[j|f]) i range(m) range m a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b c_l=list(map(int,input().split())) c_l list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split f=0 f 0 for c_i in c_l:
        f+=1<<(c_i-1)
     c_i c_l f+=1<<(c_i-1) f 1<<(c_i-1) 1 c_i-1 c_i 1 for j in range(g-1, -1, -1):
        dp[j|f]=min(dp[j]+a, dp[j|f]) j range(g-1, -1, -1) range g-1 g 1 -1 -1 dp[j|f]=min(dp[j]+a, dp[j|f]) dp[j|f] dp j|f j f min(dp[j]+a, dp[j|f]) min dp[j]+a dp[j] dp j a dp[j|f] dp j|f j f print(-1 if dp[-1]==float("inf") else dp[-1]) print -1 if dp[-1]==float("inf") else dp[-1] dp[-1]==float("inf") dp[-1] dp -1 float("inf") float "inf" -1 dp[-1] dp -1 b=map(int,input().split()) map(int,input().split()) b g=(1<<n) 1<<n g f+=1<<(c_i-1) 1<<(c_i-1) f n,m=map(int,input().split()) map(int,input().split()) n m=map(int,input().split()) map(int,input().split()) m a,b=map(int,input().split()) map(int,input().split()) a f=0 0 f dp=[float("inf")]*g [float("inf")]*g dp c_l=list(map(int,input().split())) list(map(int,input().split())) c_l
n,m=map(int,input().split())
g=(1<<n)

dp=[float("inf")]*g
dp[0]=0
for i in range(m):
    a,b=map(int,input().split())
    c_l=list(map(int,input().split()))
    f=0
    for c_i in c_l:
        f+=1<<(c_i-1)
    for j in range(g-1, -1, -1):
        dp[j|f]=min(dp[j]+a, dp[j|f])

print(-1 if dp[-1]==float("inf") else dp[-1])
