n, m = map(int, input().split())
dp = [float("inf") for i in range(2 ** n)]
dp[0] = 0

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

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