n, m = map(int, input().split())

dp = [float('inf')] * (1 << n)
dp[0] = 0
for i in range(m):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))

    SS = sum([1 << (cc - 1) for cc in c])
    for S in range(1 << n):
        dp[S | SS] = min(dp[S | SS], dp[S] + a)

if dp[-1] == float('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 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 for i in range(m):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))

    SS = sum([1 << (cc - 1) for cc in c])
    for S in range(1 << n):
        dp[S | SS] = min(dp[S | SS], dp[S] + 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 1 << (cc - 1) for cc in c for cc in c cc c for cc in c 1 << (cc - 1) 1 cc - 1 cc 1 SS = sum([1 << (cc - 1) for cc in c]) SS sum([1 << (cc - 1) for cc in c]) sum [1 << (cc - 1) for cc in c] for S in range(1 << n):
        dp[S | SS] = min(dp[S | SS], dp[S] + a) S range(1 << n) range 1 << n 1 n dp[S | SS] = min(dp[S | SS], dp[S] + a) dp[S | SS] dp S | SS S SS min(dp[S | SS], dp[S] + a) min dp[S | SS] dp S | SS S SS dp[S] + a dp[S] dp S a if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1]) dp[-1] == float('inf') dp[-1] dp -1 float('inf') float 'inf' print(-1) print -1 print(dp[-1]) print dp[-1] dp -1 SS = sum([1 << (cc - 1) for cc in c]) sum([1 << (cc - 1) for cc in c]) SS m = map(int, input().split()) map(int, input().split()) m a, b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b n, m = map(int, input().split()) map(int, input().split()) n dp = [float('inf')] * (1 << n) [float('inf')] * (1 << n) dp c = list(map(int, input().split())) list(map(int, input().split())) c
n, m = map(int, input().split())

dp = [float('inf')] * (1 << n)
dp[0] = 0
for i in range(m):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))

    SS = sum([1 << (cc - 1) for cc in c])
    for S in range(1 << n):
        dp[S | SS] = min(dp[S | SS], dp[S] + a)

if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])
