def ABC67_B():
    N, K = LI()
    L = LI()
    L.sort(reverse=True)
    ans = sum(L[:K])
    print(ans)
    return

def ABC100_C():
    def factorization_2(n):
        arr = defaultdict(int)
        temp = n
        i = 2
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr[2]
    N = I()
    A = LI()
    ans = 0
    for a in A:
        ans += factorization_2(a)
    print(ans)
    return

def ARC68_C():
    X = I()
    ans = 0
    ans += 2*(X//11)
    rest = X%11
    if rest>0:
        ans += 1
    if rest>=7:
        ans += 1
    print(ans)
    return

def ABC49_C():
    S = SI()
    T = {"maerd","remaerd","esare","resare"}
    stack = ""
    for s in S[::-1]:
        stack += s
        if stack in T:
            stack = ""
    if stack:
        print("NO")
    else:
        print("YES")
    return

def ABC142_E():
    N, M = LI()
    A = [0]*M
    C = [[]for _ in range(M)]
    for i in range(M):
        A[i], b = LI()
        C[i] = LI()
    mask = 2**N
    dp = [[inf]*mask for _ in range(M+1)]
    dp[0][0] = 0
    for i in range(M):
        key = 0
        for j in C[i]:
            key += 2**(j-1)
        #print(key)
        for now in range(mask):
            dp[i + 1][now] = min(dp[i + 1][now], dp[i][now])
            if key|now==now:
                continue
            dp[i+1][now|key] = min(dp[i+1][now|key],dp[i][now]+A[i])
    if dp[M][mask-1]==inf:
        print(-1)
    else:
        ans = dp[M][mask-1]
        print(ans)
    #print(dp)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    ABC142_E()

"""

""" def ABC67_B():
    N, K = LI()
    L = LI()
    L.sort(reverse=True)
    ans = sum(L[:K])
    print(ans)
    return ABC67_B N, K = LI() N LI() LI K L = LI() L LI() LI L.sort(reverse=True) L.sort L sort reverse=True reverse True ans = sum(L[:K]) ans sum(L[:K]) sum L[:K] L :K K print(ans) print ans return def ABC100_C():
    def factorization_2(n):
        arr = defaultdict(int)
        temp = n
        i = 2
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr[2]
    N = I()
    A = LI()
    ans = 0
    for a in A:
        ans += factorization_2(a)
    print(ans)
    return ABC100_C def factorization_2(n):
        arr = defaultdict(int)
        temp = n
        i = 2
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr[2]
     factorization_2 arr = defaultdict(int) arr defaultdict(int) defaultdict int temp = n temp n i = 2 i 2 if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
         temp % i == 0 temp % i temp i 0 cnt = 0 cnt 0 while temp % i == 0:
                cnt += 1
                temp //= i
             temp % i == 0 temp % i temp i 0 cnt += 1 cnt 1 temp //= i temp i arr[i] = cnt arr[i] arr i cnt if temp != 1:
            arr[temp] = 1
         temp != 1 temp 1 arr[temp] = 1 arr[temp] arr temp 1 if arr == []:
            arr[n] = 1
         arr == [] arr [] arr[n] = 1 arr[n] arr n 1 return arr[2] arr[2] arr 2 n n N = I() N I() I A = LI() A LI() LI ans = 0 ans 0 for a in A:
        ans += factorization_2(a)
     a A ans += factorization_2(a) ans factorization_2(a) factorization_2 a print(ans) print ans return def ARC68_C():
    X = I()
    ans = 0
    ans += 2*(X//11)
    rest = X%11
    if rest>0:
        ans += 1
    if rest>=7:
        ans += 1
    print(ans)
    return ARC68_C X = I() X I() I ans = 0 ans 0 ans += 2*(X//11) ans 2*(X//11) 2 X//11 X 11 rest = X%11 rest X%11 X 11 if rest>0:
        ans += 1
     rest>0 rest 0 ans += 1 ans 1 if rest>=7:
        ans += 1
     rest>=7 rest 7 ans += 1 ans 1 print(ans) print ans return def ABC49_C():
    S = SI()
    T = {"maerd","remaerd","esare","resare"}
    stack = ""
    for s in S[::-1]:
        stack += s
        if stack in T:
            stack = ""
    if stack:
        print("NO")
    else:
        print("YES")
    return ABC49_C S = SI() S SI() SI T = {"maerd","remaerd","esare","resare"} T {"maerd","remaerd","esare","resare"} stack = "" stack "" for s in S[::-1]:
        stack += s
        if stack in T:
            stack = ""
     s S[::-1] S ::-1 -1 stack += s stack s if stack in T:
            stack = ""
     stack in T stack T stack = "" stack "" if stack:
        print("NO")
    else:
        print("YES")
     stack print("NO") print "NO" print("YES") print "YES" return def ABC142_E():
    N, M = LI()
    A = [0]*M
    C = [[]for _ in range(M)]
    for i in range(M):
        A[i], b = LI()
        C[i] = LI()
    mask = 2**N
    dp = [[inf]*mask for _ in range(M+1)]
    dp[0][0] = 0
    for i in range(M):
        key = 0
        for j in C[i]:
            key += 2**(j-1)
        #print(key)
        for now in range(mask):
            dp[i + 1][now] = min(dp[i + 1][now], dp[i][now])
            if key|now==now:
                continue
            dp[i+1][now|key] = min(dp[i+1][now|key],dp[i][now]+A[i])
    if dp[M][mask-1]==inf:
        print(-1)
    else:
        ans = dp[M][mask-1]
        print(ans)
    #print(dp)
    return ABC142_E N, M = LI() N LI() LI M A = [0]*M A [0]*M [0] 0 M []for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) [] C = [[]for _ in range(M)] C [[]for _ in range(M)] for i in range(M):
        A[i], b = LI()
        C[i] = LI()
     i range(M) range M A[i], b = LI() A[i] A i LI() LI b C[i] = LI() C[i] C i LI() LI mask = 2**N mask 2**N 2 N [inf]*mask for _ in range(M+1) for _ in range(M+1) _ range(M+1) range M+1 M 1 for _ in range(M+1) [inf]*mask [inf] inf mask dp = [[inf]*mask for _ in range(M+1)] dp [[inf]*mask for _ in range(M+1)] dp[0][0] = 0 dp[0][0] [0] dp 0 0 0 for i in range(M):
        key = 0
        for j in C[i]:
            key += 2**(j-1)
        #print(key)
        for now in range(mask):
            dp[i + 1][now] = min(dp[i + 1][now], dp[i][now])
            if key|now==now:
                continue
            dp[i+1][now|key] = min(dp[i+1][now|key],dp[i][now]+A[i])
     i range(M) range M key = 0 key 0 for j in C[i]:
            key += 2**(j-1)
        #print(key)
         j C[i] C i key += 2**(j-1) key 2**(j-1) 2 j-1 j 1 for now in range(mask):
            dp[i + 1][now] = min(dp[i + 1][now], dp[i][now])
            if key|now==now:
                continue
            dp[i+1][now|key] = min(dp[i+1][now|key],dp[i][now]+A[i])
     now range(mask) range mask dp[i + 1][now] = min(dp[i + 1][now], dp[i][now]) dp[i + 1][now] [i + 1] dp i + 1 i 1 now min(dp[i + 1][now], dp[i][now]) min dp[i + 1][now] [i + 1] dp i + 1 i 1 now dp[i][now] [i] dp i now if key|now==now:
                continue
             key|now==now key|now key now now continue dp[i+1][now|key] = min(dp[i+1][now|key],dp[i][now]+A[i]) dp[i+1][now|key] [i+1] dp i+1 i 1 now|key now key min(dp[i+1][now|key],dp[i][now]+A[i]) min dp[i+1][now|key] [i+1] dp i+1 i 1 now|key now key dp[i][now]+A[i] dp[i][now] [i] dp i now A[i] A i if dp[M][mask-1]==inf:
        print(-1)
    else:
        ans = dp[M][mask-1]
        print(ans)
    #print(dp)
     dp[M][mask-1]==inf dp[M][mask-1] [M] dp M mask-1 mask 1 inf print(-1) print -1 ans = dp[M][mask-1] ans dp[M][mask-1] [M] dp M mask-1 mask 1 print(ans) print ans return def examF():
    ans = 0
    print(ans)
    return examF ans = 0 ans 0 print(ans) print ans return import sys,bisect,itertools,heapq,math,random sys bisect itertools heapq math random from copy import deepcopy from heapq import heappop,heappush,heapify from collections import Counter,defaultdict,deque def I(): return int(sys.stdin.readline()) I def LI(): return list(map(int,sys.stdin.readline().split())) LI def LSI(): return list(map(str,sys.stdin.readline().split())) LSI def LS(): return sys.stdin.readline().split() LS def SI(): return sys.stdin.readline().strip() SI global mod,mod2,inf,alphabet,_ep mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 mod2 = 998244353 mod2 998244353 inf = 10**18 inf 10**18 10 18 _ep = 10**(-12) _ep 10**(-12) 10 -12 chr(ord('a') + i) for i in range(26) for i in range(26) i range(26) range 26 for i in range(26) chr(ord('a') + i) chr ord('a') + i ord('a') ord 'a' i alphabet = [chr(ord('a') + i) for i in range(26)] alphabet [chr(ord('a') + i) for i in range(26)] sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 if __name__ == '__main__':
    ABC142_E() __name__ == '__main__' __name__ '__main__' ABC142_E() ABC142_E """

""" def LSI(): return list(map(str,sys.stdin.readline().split())) def LSI(): return list(map(str,sys.stdin.readline().split())) LSI def LI(): return list(map(int,sys.stdin.readline().split())) def LI(): return list(map(int,sys.stdin.readline().split())) LI global mod,mod2,inf,alphabet,_ep alphabet = [chr(ord('a') + i) for i in range(26)] [chr(ord('a') + i) for i in range(26)] alphabet def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS def ABC49_C():
    S = SI()
    T = {"maerd","remaerd","esare","resare"}
    stack = ""
    for s in S[::-1]:
        stack += s
        if stack in T:
            stack = ""
    if stack:
        print("NO")
    else:
        print("YES")
    return def ABC49_C():
    S = SI()
    T = {"maerd","remaerd","esare","resare"}
    stack = ""
    for s in S[::-1]:
        stack += s
        if stack in T:
            stack = ""
    if stack:
        print("NO")
    else:
        print("YES")
    return ABC49_C mod = 10**9 + 7 10**9 + 7 mod def SI(): return sys.stdin.readline().strip() def SI(): return sys.stdin.readline().strip() SI def ABC142_E():
    N, M = LI()
    A = [0]*M
    C = [[]for _ in range(M)]
    for i in range(M):
        A[i], b = LI()
        C[i] = LI()
    mask = 2**N
    dp = [[inf]*mask for _ in range(M+1)]
    dp[0][0] = 0
    for i in range(M):
        key = 0
        for j in C[i]:
            key += 2**(j-1)
        #print(key)
        for now in range(mask):
            dp[i + 1][now] = min(dp[i + 1][now], dp[i][now])
            if key|now==now:
                continue
            dp[i+1][now|key] = min(dp[i+1][now|key],dp[i][now]+A[i])
    if dp[M][mask-1]==inf:
        print(-1)
    else:
        ans = dp[M][mask-1]
        print(ans)
    #print(dp)
    return def ABC142_E():
    N, M = LI()
    A = [0]*M
    C = [[]for _ in range(M)]
    for i in range(M):
        A[i], b = LI()
        C[i] = LI()
    mask = 2**N
    dp = [[inf]*mask for _ in range(M+1)]
    dp[0][0] = 0
    for i in range(M):
        key = 0
        for j in C[i]:
            key += 2**(j-1)
        #print(key)
        for now in range(mask):
            dp[i + 1][now] = min(dp[i + 1][now], dp[i][now])
            if key|now==now:
                continue
            dp[i+1][now|key] = min(dp[i+1][now|key],dp[i][now]+A[i])
    if dp[M][mask-1]==inf:
        print(-1)
    else:
        ans = dp[M][mask-1]
        print(ans)
    #print(dp)
    return ABC142_E _ep = 10**(-12) 10**(-12) _ep def ARC68_C():
    X = I()
    ans = 0
    ans += 2*(X//11)
    rest = X%11
    if rest>0:
        ans += 1
    if rest>=7:
        ans += 1
    print(ans)
    return def ARC68_C():
    X = I()
    ans = 0
    ans += 2*(X//11)
    rest = X%11
    if rest>0:
        ans += 1
    if rest>=7:
        ans += 1
    print(ans)
    return ARC68_C def examF():
    ans = 0
    print(ans)
    return def examF():
    ans = 0
    print(ans)
    return examF mod2 = 998244353 998244353 mod2 def ABC100_C():
    def factorization_2(n):
        arr = defaultdict(int)
        temp = n
        i = 2
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr[2]
    N = I()
    A = LI()
    ans = 0
    for a in A:
        ans += factorization_2(a)
    print(ans)
    return def ABC100_C():
    def factorization_2(n):
        arr = defaultdict(int)
        temp = n
        i = 2
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr[2]
    N = I()
    A = LI()
    ans = 0
    for a in A:
        ans += factorization_2(a)
    print(ans)
    return ABC100_C def ABC67_B():
    N, K = LI()
    L = LI()
    L.sort(reverse=True)
    ans = sum(L[:K])
    print(ans)
    return def ABC67_B():
    N, K = LI()
    L = LI()
    L.sort(reverse=True)
    ans = sum(L[:K])
    print(ans)
    return ABC67_B inf = 10**18 10**18 inf
def ABC67_B():
    N, K = LI()
    L = LI()
    L.sort(reverse=True)
    ans = sum(L[:K])
    print(ans)
    return

def ABC100_C():
    def factorization_2(n):
        arr = defaultdict(int)
        temp = n
        i = 2
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr[2]
    N = I()
    A = LI()
    ans = 0
    for a in A:
        ans += factorization_2(a)
    print(ans)
    return

def ARC68_C():
    X = I()
    ans = 0
    ans += 2*(X//11)
    rest = X%11
    if rest>0:
        ans += 1
    if rest>=7:
        ans += 1
    print(ans)
    return

def ABC49_C():
    S = SI()
    T = {"maerd","remaerd","esare","resare"}
    stack = ""
    for s in S[::-1]:
        stack += s
        if stack in T:
            stack = ""
    if stack:
        print("NO")
    else:
        print("YES")
    return

def ABC142_E():
    N, M = LI()
    A = [0]*M
    C = [[]for _ in range(M)]
    for i in range(M):
        A[i], b = LI()
        C[i] = LI()
    mask = 2**N
    dp = [[inf]*mask for _ in range(M+1)]
    dp[0][0] = 0
    for i in range(M):
        key = 0
        for j in C[i]:
            key += 2**(j-1)
        #print(key)
        for now in range(mask):
            dp[i + 1][now] = min(dp[i + 1][now], dp[i][now])
            if key|now==now:
                continue
            dp[i+1][now|key] = min(dp[i+1][now|key],dp[i][now]+A[i])
    if dp[M][mask-1]==inf:
        print(-1)
    else:
        ans = dp[M][mask-1]
        print(ans)
    #print(dp)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    ABC142_E()

"""

"""