N,M=map(int,input().split())

def conv_to_bit(clist):
  ret=0
  for c in clist:
    ret+=2**(c-1)
  return ret

alist=[]
cmat=[]
for i in range(M):
  a,b=map(int,input().split())
  alist.append(a)
  clist=list(map(int,input().split()))
  cmat.append(clist)
  
dp=[]
for i in range(M+1):
  dp.append([float("inf")]*(2**N))
dp[0][0]=0
  
for i in range(M):
  cbit=conv_to_bit(cmat[i])
  for j in range(2**N):
    dp[i+1][j]=dp[i][j]

  for j in range(2**N):
    bit_or=j|cbit
    dp[i+1][bit_or]=min(dp[i+1][bit_or],dp[i][j]+alist[i])
    
if dp[-1][-1]==float("inf"):
  print(-1)
else:
  print(dp[-1][-1]) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M def conv_to_bit(clist):
  ret=0
  for c in clist:
    ret+=2**(c-1)
  return ret conv_to_bit ret=0 ret 0 for c in clist:
    ret+=2**(c-1)
   c clist ret+=2**(c-1) ret 2**(c-1) 2 c-1 c 1 return ret ret clist clist alist=[] alist [] cmat=[] cmat [] for i in range(M):
  a,b=map(int,input().split())
  alist.append(a)
  clist=list(map(int,input().split()))
  cmat.append(clist)
   i range(M) range M a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b alist.append(a) alist.append alist append a clist=list(map(int,input().split())) clist list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split cmat.append(clist) cmat.append cmat append clist dp=[] dp [] for i in range(M+1):
  dp.append([float("inf")]*(2**N)) i range(M+1) range M+1 M 1 dp.append([float("inf")]*(2**N)) dp.append dp append [float("inf")]*(2**N) [float("inf")] float("inf") float "inf" 2**N 2 N dp[0][0]=0 dp[0][0] [0] dp 0 0 0 for i in range(M):
  cbit=conv_to_bit(cmat[i])
  for j in range(2**N):
    dp[i+1][j]=dp[i][j]

  for j in range(2**N):
    bit_or=j|cbit
    dp[i+1][bit_or]=min(dp[i+1][bit_or],dp[i][j]+alist[i])
     i range(M) range M cbit=conv_to_bit(cmat[i]) cbit conv_to_bit(cmat[i]) conv_to_bit cmat[i] cmat i for j in range(2**N):
    dp[i+1][j]=dp[i][j]

   j range(2**N) range 2**N 2 N dp[i+1][j]=dp[i][j] dp[i+1][j] [i+1] dp i+1 i 1 j dp[i][j] [i] dp i j for j in range(2**N):
    bit_or=j|cbit
    dp[i+1][bit_or]=min(dp[i+1][bit_or],dp[i][j]+alist[i])
     j range(2**N) range 2**N 2 N bit_or=j|cbit bit_or j|cbit j cbit dp[i+1][bit_or]=min(dp[i+1][bit_or],dp[i][j]+alist[i]) dp[i+1][bit_or] [i+1] dp i+1 i 1 bit_or min(dp[i+1][bit_or],dp[i][j]+alist[i]) min dp[i+1][bit_or] [i+1] dp i+1 i 1 bit_or dp[i][j]+alist[i] dp[i][j] [i] dp i j alist[i] alist i if dp[-1][-1]==float("inf"):
  print(-1)
else:
  print(dp[-1][-1]) dp[-1][-1]==float("inf") dp[-1][-1] [-1] dp -1 -1 float("inf") float "inf" print(-1) print -1 print(dp[-1][-1]) print dp[-1][-1] [-1] dp -1 -1 alist=[] [] alist cbit=conv_to_bit(cmat[i]) conv_to_bit(cmat[i]) cbit N,M=map(int,input().split()) map(int,input().split()) N def conv_to_bit(clist):
  ret=0
  for c in clist:
    ret+=2**(c-1)
  return ret def conv_to_bit(clist):
  ret=0
  for c in clist:
    ret+=2**(c-1)
  return ret conv_to_bit cmat=[] [] cmat clist=list(map(int,input().split())) list(map(int,input().split())) clist dp=[] [] dp M=map(int,input().split()) map(int,input().split()) M b=map(int,input().split()) map(int,input().split()) b bit_or=j|cbit j|cbit bit_or a,b=map(int,input().split()) map(int,input().split()) a
N,M=map(int,input().split())

def conv_to_bit(clist):
  ret=0
  for c in clist:
    ret+=2**(c-1)
  return ret

alist=[]
cmat=[]
for i in range(M):
  a,b=map(int,input().split())
  alist.append(a)
  clist=list(map(int,input().split()))
  cmat.append(clist)
  
dp=[]
for i in range(M+1):
  dp.append([float("inf")]*(2**N))
dp[0][0]=0
  
for i in range(M):
  cbit=conv_to_bit(cmat[i])
  for j in range(2**N):
    dp[i+1][j]=dp[i][j]

  for j in range(2**N):
    bit_or=j|cbit
    dp[i+1][bit_or]=min(dp[i+1][bit_or],dp[i][j]+alist[i])
    
if dp[-1][-1]==float("inf"):
  print(-1)
else:
  print(dp[-1][-1])