n,m = map(int,input().split())
x = 2**n
dp = [1000000000 for _ in range(x)]
dp[0] = 0
for i in range(m):
    ai,bi = map(int,input().split())
    c = list(map(int,input().split()))
    bit = 0
    for j in range(bi):
        bit += 2**(c[j]-1)
    for k in range(x):
        dp[k | bit] = min(dp[k | bit],dp[k] + ai)
if dp[x-1] == 1000000000:
    print(-1)
else:
    print(dp[x-1]) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m x = 2**n x 2**n 2 n 1000000000 for _ in range(x) for _ in range(x) _ range(x) range x for _ in range(x) 1000000000 dp = [1000000000 for _ in range(x)] dp [1000000000 for _ in range(x)] dp[0] = 0 dp[0] dp 0 0 for i in range(m):
    ai,bi = map(int,input().split())
    c = list(map(int,input().split()))
    bit = 0
    for j in range(bi):
        bit += 2**(c[j]-1)
    for k in range(x):
        dp[k | bit] = min(dp[k | bit],dp[k] + ai) i range(m) range m ai,bi = map(int,input().split()) ai map(int,input().split()) map int input().split() ().split () input split bi c = list(map(int,input().split())) c list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split bit = 0 bit 0 for j in range(bi):
        bit += 2**(c[j]-1)
     j range(bi) range bi bit += 2**(c[j]-1) bit 2**(c[j]-1) 2 c[j]-1 c[j] c j 1 for k in range(x):
        dp[k | bit] = min(dp[k | bit],dp[k] + ai) k range(x) range x dp[k | bit] = min(dp[k | bit],dp[k] + ai) dp[k | bit] dp k | bit k bit min(dp[k | bit],dp[k] + ai) min dp[k | bit] dp k | bit k bit dp[k] + ai dp[k] dp k ai if dp[x-1] == 1000000000:
    print(-1)
else:
    print(dp[x-1]) dp[x-1] == 1000000000 dp[x-1] dp x-1 x 1 1000000000 print(-1) print -1 print(dp[x-1]) print dp[x-1] dp x-1 x 1 x = 2**n 2**n x bit += 2**(c[j]-1) 2**(c[j]-1) bit m = map(int,input().split()) map(int,input().split()) m c = list(map(int,input().split())) list(map(int,input().split())) c bit = 0 0 bit bi = map(int,input().split()) map(int,input().split()) bi dp = [1000000000 for _ in range(x)] [1000000000 for _ in range(x)] dp n,m = map(int,input().split()) map(int,input().split()) n ai,bi = map(int,input().split()) map(int,input().split()) ai
n,m = map(int,input().split())
x = 2**n
dp = [1000000000 for _ in range(x)]
dp[0] = 0
for i in range(m):
    ai,bi = map(int,input().split())
    c = list(map(int,input().split()))
    bit = 0
    for j in range(bi):
        bit += 2**(c[j]-1)
    for k in range(x):
        dp[k | bit] = min(dp[k | bit],dp[k] + ai)
if dp[x-1] == 1000000000:
    print(-1)
else:
    print(dp[x-1])
