n,m = map(int,input().split())
dp = [float("inf")]*(1<<n)
dp[0]=0
kagi = []
for i in range(m):
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    kagi.append([a,b,c])
for j in range(m):
    for i in range(1<<n):
        tmp = i+0
        for k in kagi[j][2]:
            tmp = tmp | 1<<(k-1)
        dp[tmp] = min(dp[tmp],dp[i]+kagi[j][0])
print(dp[(1<<n)-1] if dp[(1<<n)-1] != float("inf") else -1) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m dp = [float("inf")]*(1<<n) dp [float("inf")]*(1<<n) [float("inf")] float("inf") float "inf" 1<<n 1 n dp[0]=0 dp[0] dp 0 0 kagi = [] kagi [] for i in range(m):
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    kagi.append([a,b,c]) 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 = list(map(int,input().split())) c list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split kagi.append([a,b,c]) kagi.append kagi append [a,b,c] a b c for j in range(m):
    for i in range(1<<n):
        tmp = i+0
        for k in kagi[j][2]:
            tmp = tmp | 1<<(k-1)
        dp[tmp] = min(dp[tmp],dp[i]+kagi[j][0]) j range(m) range m for i in range(1<<n):
        tmp = i+0
        for k in kagi[j][2]:
            tmp = tmp | 1<<(k-1)
        dp[tmp] = min(dp[tmp],dp[i]+kagi[j][0]) i range(1<<n) range 1<<n 1 n tmp = i+0 tmp i+0 i 0 for k in kagi[j][2]:
            tmp = tmp | 1<<(k-1)
         k kagi[j][2] [j] kagi j 2 tmp = tmp | 1<<(k-1) tmp tmp | 1<<(k-1) tmp 1<<(k-1) 1 k-1 k 1 dp[tmp] = min(dp[tmp],dp[i]+kagi[j][0]) dp[tmp] dp tmp min(dp[tmp],dp[i]+kagi[j][0]) min dp[tmp] dp tmp dp[i]+kagi[j][0] dp[i] dp i kagi[j][0] [j] kagi j 0 print(dp[(1<<n)-1] if dp[(1<<n)-1] != float("inf") else -1) print dp[(1<<n)-1] if dp[(1<<n)-1] != float("inf") else -1 dp[(1<<n)-1] != float("inf") dp[(1<<n)-1] dp (1<<n)-1 1<<n 1 n 1 float("inf") float "inf" dp[(1<<n)-1] dp (1<<n)-1 1<<n 1 n 1 -1 c = list(map(int,input().split())) list(map(int,input().split())) c dp = [float("inf")]*(1<<n) [float("inf")]*(1<<n) dp b = map(int,input().split()) map(int,input().split()) b tmp = tmp | 1<<(k-1) tmp | 1<<(k-1) tmp tmp = i+0 i+0 tmp n,m = map(int,input().split()) map(int,input().split()) n a,b = map(int,input().split()) map(int,input().split()) a m = map(int,input().split()) map(int,input().split()) m kagi = [] [] kagi
n,m = map(int,input().split())
dp = [float("inf")]*(1<<n)
dp[0]=0
kagi = []
for i in range(m):
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    kagi.append([a,b,c])
for j in range(m):
    for i in range(1<<n):
        tmp = i+0
        for k in kagi[j][2]:
            tmp = tmp | 1<<(k-1)
        dp[tmp] = min(dp[tmp],dp[i]+kagi[j][0])
print(dp[(1<<n)-1] if dp[(1<<n)-1] != float("inf") else -1)