from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    N, M = MI()
    a = [0] * M
    b = [0] * M
    c = [0] * M
    dp = [IINF for i in range(2 ** N)]

    for i in range(M):
        a[i], b[i] = MI()
        tmp = LI()
        for v in tmp:
            c[i] |= 1 << (v-1)

    dp[0] = 0
    for i in range(M):
        for bit in range(2 ** N):
            dp[bit | c[i]] = min(dp[bit | c[i]], dp[bit] + a[i])

    if dp[2**N-1] == IINF:
        print(-1)
    else:
        print(dp[2**N-1])


if __name__ == '__main__':
    main() from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools itertools from itertools import permutations, combinations, accumulate, product, combinations_with_replacement import sys sys import bisect bisect import string string import math math import time time def I(): return int(input()) I def S(): return input() S def MI(): return map(int, input().split()) MI def MS(): return map(str, input().split()) MS int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i def LI(): return [int(i) for i in input().split()] LI int(i)-1 for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i)-1 int(i) int i 1 def LI_(): return [int(i)-1 for i in input().split()] LI_ ord(i)-97 for i in input() for i in input() i input() input for i in input() ord(i)-97 ord(i) ord i 97 def StoI(): return [ord(i)-97 for i in input()] StoI def ItoS(nn): return chr(nn+97) ItoS nn nn def input(): return sys.stdin.readline().rstrip() input [c] * b for i in range(a) for i in range(a) i range(a) range a for i in range(a) [c] * b [c] c b def list2d(a, b, c): return [[c] * b for i in range(a)] list2d a a b b c c [[d] * c for j in range(b)] for i in range(a) for i in range(a) i range(a) range a for i in range(a) [[d] * c for j in range(b)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] list3d a a b b c c d d [[[e] * d for j in range(c)] for j in range(b)] for i in range(a) for i in range(a) i range(a) range a for i in range(a) [[[e] * d for j in range(c)] for j in range(b)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] list4d a a b b c c d d e e def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]]) print_matrix for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]]) i range(len(mat)) range len(mat) len mat 'IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i] for v in mat[i] v mat[i] mat i for v in mat[i] 'IINF' if v == IINF else "{:0=4}".format(v) v == IINF v IINF 'IINF' "{:0=4}".format(v) "{:0=4}".format "{:0=4}" format v print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]]) print *['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]] ['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]] mat mat yn = {False: 'No', True: 'Yes'} yn {False: 'No', True: 'Yes'} False False 'No' True True 'Yes' YN = {False: 'NO', True: 'YES'} YN {False: 'NO', True: 'YES'} False False 'NO' True True 'YES' MOD = 10**9+7 MOD 10**9+7 10**9 10 9 7 inf = float('inf') inf float('inf') float 'inf' IINF = 10**19 IINF 10**19 10 19 l_alp = string.ascii_lowercase l_alp string.ascii_lowercase string ascii_lowercase u_alp = string.ascii_uppercase u_alp string.ascii_uppercase string ascii_uppercase ts = time.time() ts time.time() time.time time time sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] nums ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] '1' '2' '3' '4' '5' '6' '7' '8' '9' '10' show_flg = False show_flg False def main():
    N, M = MI()
    a = [0] * M
    b = [0] * M
    c = [0] * M
    dp = [IINF for i in range(2 ** N)]

    for i in range(M):
        a[i], b[i] = MI()
        tmp = LI()
        for v in tmp:
            c[i] |= 1 << (v-1)

    dp[0] = 0
    for i in range(M):
        for bit in range(2 ** N):
            dp[bit | c[i]] = min(dp[bit | c[i]], dp[bit] + a[i])

    if dp[2**N-1] == IINF:
        print(-1)
    else:
        print(dp[2**N-1]) main N, M = MI() N MI() MI M a = [0] * M a [0] * M [0] 0 M b = [0] * M b [0] * M [0] 0 M c = [0] * M c [0] * M [0] 0 M IINF 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) IINF dp = [IINF for i in range(2 ** N)] dp [IINF for i in range(2 ** N)] for i in range(M):
        a[i], b[i] = MI()
        tmp = LI()
        for v in tmp:
            c[i] |= 1 << (v-1)

     i range(M) range M a[i], b[i] = MI() a[i] a i MI() MI b[i] b i tmp = LI() tmp LI() LI for v in tmp:
            c[i] |= 1 << (v-1)

     v tmp c[i] |= 1 << (v-1) c[i] c i 1 << (v-1) 1 v-1 v 1 dp[0] = 0 dp[0] dp 0 0 for i in range(M):
        for bit in range(2 ** N):
            dp[bit | c[i]] = min(dp[bit | c[i]], dp[bit] + a[i])

     i range(M) range M for bit in range(2 ** N):
            dp[bit | c[i]] = min(dp[bit | c[i]], dp[bit] + a[i])

     bit range(2 ** N) range 2 ** N 2 N dp[bit | c[i]] = min(dp[bit | c[i]], dp[bit] + a[i]) dp[bit | c[i]] dp bit | c[i] bit c[i] c i min(dp[bit | c[i]], dp[bit] + a[i]) min dp[bit | c[i]] dp bit | c[i] bit c[i] c i dp[bit] + a[i] dp[bit] dp bit a[i] a i if dp[2**N-1] == IINF:
        print(-1)
    else:
        print(dp[2**N-1]) dp[2**N-1] == IINF dp[2**N-1] dp 2**N-1 2**N 2 N 1 IINF print(-1) print -1 print(dp[2**N-1]) print dp[2**N-1] dp 2**N-1 2**N 2 N 1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main show_flg = False False show_flg def ItoS(nn): return chr(nn+97) def ItoS(nn): return chr(nn+97) ItoS l_alp = string.ascii_lowercase string.ascii_lowercase l_alp def S(): return input() def S(): return input() S def list2d(a, b, c): return [[c] * b for i in range(a)] def list2d(a, b, c): return [[c] * b for i in range(a)] list2d nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] nums def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]]) def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]]) print_matrix ts = time.time() time.time() ts def StoI(): return [ord(i)-97 for i in input()] def StoI(): return [ord(i)-97 for i in input()] StoI def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] list4d YN = {False: 'NO', True: 'YES'} {False: 'NO', True: 'YES'} YN inf = float('inf') float('inf') inf def input(): return sys.stdin.readline().rstrip() def input(): return sys.stdin.readline().rstrip() input u_alp = string.ascii_uppercase string.ascii_uppercase u_alp def LI_(): return [int(i)-1 for i in input().split()] def LI_(): return [int(i)-1 for i in input().split()] LI_ def LI(): return [int(i) for i in input().split()] def LI(): return [int(i) for i in input().split()] LI yn = {False: 'No', True: 'Yes'} {False: 'No', True: 'Yes'} yn def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI def MS(): return map(str, input().split()) def MS(): return map(str, input().split()) MS MOD = 10**9+7 10**9+7 MOD IINF = 10**19 10**19 IINF def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] list3d def I(): return int(input()) def I(): return int(input()) I def main():
    N, M = MI()
    a = [0] * M
    b = [0] * M
    c = [0] * M
    dp = [IINF for i in range(2 ** N)]

    for i in range(M):
        a[i], b[i] = MI()
        tmp = LI()
        for v in tmp:
            c[i] |= 1 << (v-1)

    dp[0] = 0
    for i in range(M):
        for bit in range(2 ** N):
            dp[bit | c[i]] = min(dp[bit | c[i]], dp[bit] + a[i])

    if dp[2**N-1] == IINF:
        print(-1)
    else:
        print(dp[2**N-1]) def main():
    N, M = MI()
    a = [0] * M
    b = [0] * M
    c = [0] * M
    dp = [IINF for i in range(2 ** N)]

    for i in range(M):
        a[i], b[i] = MI()
        tmp = LI()
        for v in tmp:
            c[i] |= 1 << (v-1)

    dp[0] = 0
    for i in range(M):
        for bit in range(2 ** N):
            dp[bit | c[i]] = min(dp[bit | c[i]], dp[bit] + a[i])

    if dp[2**N-1] == IINF:
        print(-1)
    else:
        print(dp[2**N-1]) main
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    N, M = MI()
    a = [0] * M
    b = [0] * M
    c = [0] * M
    dp = [IINF for i in range(2 ** N)]

    for i in range(M):
        a[i], b[i] = MI()
        tmp = LI()
        for v in tmp:
            c[i] |= 1 << (v-1)

    dp[0] = 0
    for i in range(M):
        for bit in range(2 ** N):
            dp[bit | c[i]] = min(dp[bit | c[i]], dp[bit] + a[i])

    if dp[2**N-1] == IINF:
        print(-1)
    else:
        print(dp[2**N-1])


if __name__ == '__main__':
    main()
