#include <bits/stdc++.h>
using namespace std;

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF 1<<30
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME (1ll<<61)-1

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

template<class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template<class T>
inline void outmat(T& a, int y, int x) {
	for(int i=0; i<y; i++) {
		for(int j=0; j<x; j++) cout<<a[i][j]<<" ";
		cout<<endl;
	}
}

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}

template<class T>
class Matrix{
	vector<vector<T>> mat;
	int height, width;

public:

	Matrix(int h=1, int w=1) : height(h), width(w), mat(h,vector<T>(w)) {}
	Matrix(int h, int w, T n) : height(h), width(w), mat(h,vector<T>(w,n)) {}

	void resize(int h, int w) {
		height=h, width=w;
		mat.resize(h,vector<T>(w));
	}
	void resize(int h, int w, T n) {
		height=h, width=w;
		mat.resize(h,vector<int>(w,n));
	}

	inline vector<T>& operator[](size_t idx) {
		return mat[idx];
	}

	friend istream& operator>>(istream& is, Matrix<T>& mt) {
		for(int i=0; i<mt.height; i++) for(int j=0; j<mt.width; j++) {
			is>>mt[i][j];
		}
		return is;
	}
	friend ostream& operator<<(ostream& os, const Matrix<T>& mt) {
		for(int i=0; i<mt.height; i++) {
			for(int j=0; j<mt.width; j++) {
				os<<mt[i][j]<<" ";
			}
			os<<endl;
		}
		return os;
	};
};


int N,M;
intvec A,B,cost;
Matrix<int> C;

void input() {
	cin>>N>>M;
	resiz(M,A,B);
	C.resize(M,0);
	for(int i=0; i<M; i++) {
		cin>>A[i]>>B[i];
		C[i].resize(B[i]);
		for(int j=0; j<B[i]; j++) {
			cin>>C[i][j]; C[i][j]--;
		}
	}
	cost.resize(1<<N,INTINF);
	cost[0]=0;
}

void solve() {
	intq q; q.push(0);
	while(!q.empty()) {
		int bit=q.front(); q.pop();
		for(int i=0; i<M; i++) {
			int nbit=bit;
			for(int j=0; j<B[i]; j++) {
				nbit |= (1<<C[i][j]);
			}
			if(chmin(cost[nbit],cost[bit]+A[i])) q.push(nbit);
		}
	}
	cout<< (cost[(1<<N)-1]==INTINF ? -1 : cost[(1<<N)-1]) <<endl;
}

int main() {
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 3748