n ,m= list(map(int,input().split()))
kagi = [[]for _ in range(m)] 
#a円　b種類開けられる
for i in range(m):
    a,b =  list(map(int,input().split()))
    X =  list(map(int,input().split()))
    bit = 0
    for x in X:
        bit |= 2**(x-1)
    kagi[i] = [a,bit]

ok = 2**n-1#全部空いたらこれ
kagi.sort(key=lambda x: x[1])
zenkai = 2**n
dp = [float('inf')]*int(zenkai+1)
dp[0] = 0
for i in range(2**n):
    if dp[i] == float('inf'):
        continue
    for j in range(m):
        s = i|kagi[j][1]
        # print(s)
        dp[s] = min(dp[s],dp[i] + kagi[j][0])
# print(dp)
if dp[zenkai-1] == float('inf'):
    print(-1)
else:
    print(dp[zenkai-1]) n ,m= list(map(int,input().split())) n list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split m []for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) [] kagi = [[]for _ in range(m)] kagi [[]for _ in range(m)] for i in range(m):
    a,b =  list(map(int,input().split()))
    X =  list(map(int,input().split()))
    bit = 0
    for x in X:
        bit |= 2**(x-1)
    kagi[i] = [a,bit] i range(m) range m a,b =  list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split b X =  list(map(int,input().split())) X list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split bit = 0 bit 0 for x in X:
        bit |= 2**(x-1)
     x X bit |= 2**(x-1) bit 2**(x-1) 2 x-1 x 1 kagi[i] = [a,bit] kagi[i] kagi i [a,bit] a bit ok = 2**n-1 ok 2**n-1 2**n 2 n 1 kagi.sort(key=lambda x: x[1]) kagi.sort kagi sort key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x zenkai = 2**n zenkai 2**n 2 n dp = [float('inf')]*int(zenkai+1) dp [float('inf')]*int(zenkai+1) [float('inf')] float('inf') float 'inf' int(zenkai+1) int zenkai+1 zenkai 1 dp[0] = 0 dp[0] dp 0 0 for i in range(2**n):
    if dp[i] == float('inf'):
        continue
    for j in range(m):
        s = i|kagi[j][1]
        # print(s)
        dp[s] = min(dp[s],dp[i] + kagi[j][0])
# print(dp) i range(2**n) range 2**n 2 n if dp[i] == float('inf'):
        continue
     dp[i] == float('inf') dp[i] dp i float('inf') float 'inf' continue for j in range(m):
        s = i|kagi[j][1]
        # print(s)
        dp[s] = min(dp[s],dp[i] + kagi[j][0])
# print(dp) j range(m) range m s = i|kagi[j][1] s i|kagi[j][1] i kagi[j][1] [j] kagi j 1 dp[s] = min(dp[s],dp[i] + kagi[j][0]) dp[s] dp s min(dp[s],dp[i] + kagi[j][0]) min dp[s] dp s dp[i] + kagi[j][0] dp[i] dp i kagi[j][0] [j] kagi j 0 if dp[zenkai-1] == float('inf'):
    print(-1)
else:
    print(dp[zenkai-1]) dp[zenkai-1] == float('inf') dp[zenkai-1] dp zenkai-1 zenkai 1 float('inf') float 'inf' print(-1) print -1 print(dp[zenkai-1]) print dp[zenkai-1] dp zenkai-1 zenkai 1 X =  list(map(int,input().split())) list(map(int,input().split())) X b =  list(map(int,input().split())) list(map(int,input().split())) b ok = 2**n-1 2**n-1 ok kagi = [[]for _ in range(m)] [[]for _ in range(m)] kagi dp = [float('inf')]*int(zenkai+1) [float('inf')]*int(zenkai+1) dp s = i|kagi[j][1] i|kagi[j][1] s a,b =  list(map(int,input().split())) list(map(int,input().split())) a n ,m= list(map(int,input().split())) list(map(int,input().split())) n bit = 0 0 bit m= list(map(int,input().split())) list(map(int,input().split())) m zenkai = 2**n 2**n zenkai bit |= 2**(x-1) 2**(x-1) bit
n ,m= list(map(int,input().split()))
kagi = [[]for _ in range(m)] 
#a円　b種類開けられる
for i in range(m):
    a,b =  list(map(int,input().split()))
    X =  list(map(int,input().split()))
    bit = 0
    for x in X:
        bit |= 2**(x-1)
    kagi[i] = [a,bit]

ok = 2**n-1#全部空いたらこれ
kagi.sort(key=lambda x: x[1])
zenkai = 2**n
dp = [float('inf')]*int(zenkai+1)
dp[0] = 0
for i in range(2**n):
    if dp[i] == float('inf'):
        continue
    for j in range(m):
        s = i|kagi[j][1]
        # print(s)
        dp[s] = min(dp[s],dp[i] + kagi[j][0])
# print(dp)
if dp[zenkai-1] == float('inf'):
    print(-1)
else:
    print(dp[zenkai-1])