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