import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()

key_lis = []
key_cost = []

for _ in range(M):
	a, b = MAP()
	c = LIST()
	key = 0
	for x in c:
		key += 2**(x-1)
	key_lis.append(key)
	key_cost.append(a)


dp = [INF]*(1<<N)
dp[0] = 0

for S in range(1<<N):
	for i, key in enumerate(key_lis):
		dp[S|key] = min(dp[S|key], dp[S]+key_cost[i])

if dp[-1] == INF:
	print(-1)
else:
	print(dp[-1]) import sys, re sys re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP def LIST(): return list(map(int, input().split())) LIST sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = float('inf') INF float('inf') float 'inf' MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 N, M = MAP() N MAP() MAP M key_lis = [] key_lis [] key_cost = [] key_cost [] for _ in range(M):
	a, b = MAP()
	c = LIST()
	key = 0
	for x in c:
		key += 2**(x-1)
	key_lis.append(key)
	key_cost.append(a) _ range(M) range M a, b = MAP() a MAP() MAP b c = LIST() c LIST() LIST key = 0 key 0 for x in c:
		key += 2**(x-1)
	 x c key += 2**(x-1) key 2**(x-1) 2 x-1 x 1 key_lis.append(key) key_lis.append key_lis append key key_cost.append(a) key_cost.append key_cost append a dp = [INF]*(1<<N) dp [INF]*(1<<N) [INF] INF 1<<N 1 N dp[0] = 0 dp[0] dp 0 0 for S in range(1<<N):
	for i, key in enumerate(key_lis):
		dp[S|key] = min(dp[S|key], dp[S]+key_cost[i]) S range(1<<N) range 1<<N 1 N for i, key in enumerate(key_lis):
		dp[S|key] = min(dp[S|key], dp[S]+key_cost[i]) i key enumerate(key_lis) enumerate key_lis dp[S|key] = min(dp[S|key], dp[S]+key_cost[i]) dp[S|key] dp S|key S key min(dp[S|key], dp[S]+key_cost[i]) min dp[S|key] dp S|key S key dp[S]+key_cost[i] dp[S] dp S key_cost[i] key_cost i 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 N, M = MAP() MAP() N def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def LIST(): return list(map(int, input().split())) def LIST(): return list(map(int, input().split())) LIST MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD key_cost = [] [] key_cost M = MAP() MAP() M a, b = MAP() MAP() a key += 2**(x-1) 2**(x-1) key dp = [INF]*(1<<N) [INF]*(1<<N) dp c = LIST() LIST() c key = 0 0 key def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP INF = float('inf') float('inf') INF b = MAP() MAP() b key_lis = [] [] key_lis def INT(): return int(input()) def INT(): return int(input()) INT
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()

key_lis = []
key_cost = []

for _ in range(M):
	a, b = MAP()
	c = LIST()
	key = 0
	for x in c:
		key += 2**(x-1)
	key_lis.append(key)
	key_cost.append(a)


dp = [INF]*(1<<N)
dp[0] = 0

for S in range(1<<N):
	for i, key in enumerate(key_lis):
		dp[S|key] = min(dp[S|key], dp[S]+key_cost[i])

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