N,M=map(int,input().split())
INF=10**18
dp=[INF]*(1<<N)
dp[0]=0
cost=[None]*M
target=[0]*M

for i in range(M):
    cost[i],b=map(int,input().split())
    
    c=[int(x) for x in input().split()]
    for j in c:
        target[i]=target[i]|(1<<(j-1))
    
for s in range(1<<N):
    for i in range(M):
        ns=s|target[i]
        dp[ns]=min(dp[ns],dp[s]+cost[i])
if dp[-1]==INF:
    print(-1)
else :
    print(dp[-1]) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M INF=10**18 INF 10**18 10 18 dp=[INF]*(1<<N) dp [INF]*(1<<N) [INF] INF 1<<N 1 N dp[0]=0 dp[0] dp 0 0 cost=[None]*M cost [None]*M [None] None M target=[0]*M target [0]*M [0] 0 M for i in range(M):
    cost[i],b=map(int,input().split())
    
    c=[int(x) for x in input().split()]
    for j in c:
        target[i]=target[i]|(1<<(j-1))
     i range(M) range M cost[i],b=map(int,input().split()) cost[i] cost i map(int,input().split()) map int input().split() ().split () input split b int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x c=[int(x) for x in input().split()] c [int(x) for x in input().split()] for j in c:
        target[i]=target[i]|(1<<(j-1))
     j c target[i]=target[i]|(1<<(j-1)) target[i] target i target[i]|(1<<(j-1)) target[i] target i 1<<(j-1) 1 j-1 j 1 for s in range(1<<N):
    for i in range(M):
        ns=s|target[i]
        dp[ns]=min(dp[ns],dp[s]+cost[i]) s range(1<<N) range 1<<N 1 N for i in range(M):
        ns=s|target[i]
        dp[ns]=min(dp[ns],dp[s]+cost[i]) i range(M) range M ns=s|target[i] ns s|target[i] s target[i] target i dp[ns]=min(dp[ns],dp[s]+cost[i]) dp[ns] dp ns min(dp[ns],dp[s]+cost[i]) min dp[ns] dp ns dp[s]+cost[i] dp[s] dp s cost[i] cost i if dp[-1]==INF:
    print(-1)
else :
    print(dp[-1]) dp[-1]==INF dp[-1] dp -1 INF print(-1) print -1 print(dp[-1]) print dp[-1] dp -1 cost=[None]*M [None]*M cost dp=[INF]*(1<<N) [INF]*(1<<N) dp target=[0]*M [0]*M target INF=10**18 10**18 INF N,M=map(int,input().split()) map(int,input().split()) N ns=s|target[i] s|target[i] ns b=map(int,input().split()) map(int,input().split()) b c=[int(x) for x in input().split()] [int(x) for x in input().split()] c M=map(int,input().split()) map(int,input().split()) M
N,M=map(int,input().split())
INF=10**18
dp=[INF]*(1<<N)
dp[0]=0
cost=[None]*M
target=[0]*M

for i in range(M):
    cost[i],b=map(int,input().split())
    
    c=[int(x) for x in input().split()]
    for j in c:
        target[i]=target[i]|(1<<(j-1))
    
for s in range(1<<N):
    for i in range(M):
        ns=s|target[i]
        dp[ns]=min(dp[ns],dp[s]+cost[i])
if dp[-1]==INF:
    print(-1)
else :
    print(dp[-1])
