n, m = map(int, input().split())
inf = 10 ** 10
dp = [inf for _ in range(2 ** n)]
dp[0] = 0
bin_s = [2 ** i for i in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    clst = list(map(int, input().split()))
    tmp = 2 ** n - 1
    for c in clst:
        tmp -= bin_s[c - 1]
    for i in range(2 ** n):
        dp[i] = min(dp[i], dp[i & tmp] + a)

if dp[-1] == 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 inf = 10 ** 10 inf 10 ** 10 10 10 inf for _ in range(2 ** n) for _ in range(2 ** n) _ range(2 ** n) range 2 ** n 2 n for _ in range(2 ** n) inf dp = [inf for _ in range(2 ** n)] dp [inf for _ in range(2 ** n)] dp[0] = 0 dp[0] dp 0 0 2 ** i for i in range(n) for i in range(n) i range(n) range n for i in range(n) 2 ** i 2 i bin_s = [2 ** i for i in range(n)] bin_s [2 ** i for i in range(n)] for _ in range(m):
    a, b = map(int, input().split())
    clst = list(map(int, input().split()))
    tmp = 2 ** n - 1
    for c in clst:
        tmp -= bin_s[c - 1]
    for i in range(2 ** n):
        dp[i] = min(dp[i], dp[i & tmp] + a) _ range(m) range m a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b clst = list(map(int, input().split())) clst list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split tmp = 2 ** n - 1 tmp 2 ** n - 1 2 ** n 2 n 1 for c in clst:
        tmp -= bin_s[c - 1]
     c clst tmp -= bin_s[c - 1] tmp bin_s[c - 1] bin_s c - 1 c 1 for i in range(2 ** n):
        dp[i] = min(dp[i], dp[i & tmp] + a) i range(2 ** n) range 2 ** n 2 n dp[i] = min(dp[i], dp[i & tmp] + a) dp[i] dp i min(dp[i], dp[i & tmp] + a) min dp[i] dp i dp[i & tmp] + a dp[i & tmp] dp i & tmp i tmp a if dp[-1] == inf:
    print(-1)
else:
    print(dp[-1]) dp[-1] == inf dp[-1] dp -1 inf print(-1) print -1 print(dp[-1]) print dp[-1] dp -1 a, b = map(int, input().split()) map(int, input().split()) a n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m bin_s = [2 ** i for i in range(n)] [2 ** i for i in range(n)] bin_s dp = [inf for _ in range(2 ** n)] [inf for _ in range(2 ** n)] dp b = map(int, input().split()) map(int, input().split()) b clst = list(map(int, input().split())) list(map(int, input().split())) clst inf = 10 ** 10 10 ** 10 inf tmp = 2 ** n - 1 2 ** n - 1 tmp tmp -= bin_s[c - 1] bin_s[c - 1] tmp
n, m = map(int, input().split())
inf = 10 ** 10
dp = [inf for _ in range(2 ** n)]
dp[0] = 0
bin_s = [2 ** i for i in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    clst = list(map(int, input().split()))
    tmp = 2 ** n - 1
    for c in clst:
        tmp -= bin_s[c - 1]
    for i in range(2 ** n):
        dp[i] = min(dp[i], dp[i & tmp] + a)

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