using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;

namespace PAST0
{
    using static Ex;
    public class Solve
    {
        public static void Main(string[] args)
        {
            new PAST_J();
        }
    }
    public class PAST_J
    {
        // 宝箱がN個 鍵M個
        int n, m;
        long ans = long.MaxValue;
        Tuple<long, long>[] arr;
        public PAST_J()
        {
            var l = ReadIntArray();
            n = l[0];
            m = l[1];
            arr = new Tuple<long, long>[m];
            for (int i = 0; i < m; i++)
            {
                // ai円で販売されており、bi種類
                var l1 = ReadLongArray();
                var a = l1[0];
                var b = l1[1];
                var c = ReadIntArray();
                int s = 0;
                for (int k = 0; k < b; k++)
                {
                    c[k]--;
                    s |= 1 << c[k];
                }
                arr[i] = new Tuple<long, long>(a, s);
            }

            long[] dp = new long[1 << n];
            for (int j = 0; j < 1 << n; j++)
            {
                dp[j] = long.MaxValue;
            }
            dp[0] = 0;
            for (long j = 0; j < 1 << n; j++)
            {
                for (long i = 0; i < m; i++)
                {
                    var t = j | arr[i].Item2;
                    var c = arr[i].Item1 > long.MaxValue - dp[j] ? long.MaxValue : dp[j] + arr[i].Item1;
                    dp[t] = Math.Min(dp[t], c);
                }
            }

            ans = dp.LastOrDefault();

            if (ans == long.MaxValue) ans = -1;
            ans.Cw();
        }
    }
    public class PAST_K
    {
        public PAST_K()
        {
        }
    }
    public class PAST_L
    {
        public PAST_L()
        {
        }
    }
    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }



        public static bool Mins<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
        public static bool Maxs<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
        public static void Swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
        public static void Swap<T>(List<T> list, int i, int j) { T tmp = list[j]; list[j] = list[i]; list[i] = tmp; }


        static long Gcd(long m, long n) { if (n == 0) return m; return Gcd(n, m % n); }
        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static void yesno(this bool b) { (b ? "yes" : "no").Cw(); }
        public static void YesNo(this bool b) { (b ? "Yes" : "No").Cw(); }
        public static void YESNO(this bool b) { (b ? "YES" : "NO").Cw(); }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public static long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }


        public class PriorityQueue<T> where T : IComparable<T>
        {
            List<T> list = new List<T>();
            void PushHeap(T v)
            {
                int n = list.Count;
                list.Add(v);

                while (n != 0)
                {
                    int i = (n - 1) / 2;
                    if (list[n].CompareTo(list[i]) > 0)
                        Swap(list, i, n);
                    n = i;
                }
            }
            void PopHeap()
            {
                int n = list.Count - 1;
                list[0] = list[n];
                list.RemoveAt(n);

                for (int i = 0, j; (j = 2 * i + 1) < n;)
                {
                    if ((j != n - 1) && (list[j].CompareTo(list[j + 1]) < 0))
                        j++;
                    if (list[i].CompareTo(list[j]) < 0)
                        Swap(list, i, j);
                    i = j;
                }
            }
            public void Push(T elem) { PushHeap(elem); }
            public T Pop() { var v = Peek; PopHeap(); return v; }
            public T Peek { get { return list[0]; } }
            public int Count { get { return list.Count; } }
        }

    }
    public struct Mod : IEquatable<Mod>, IEquatable<long>
    {
        static public long _mod = 1000000007; long v;
        public Mod(long x) { if (x < _mod && x >= 0) v = x; else if ((v = x % _mod) < 0) v += _mod; }
        static public implicit operator Mod(long x) => new Mod(x);
        static public implicit operator long(Mod x) => x.v;
        public void Add(Mod x) { if ((v += x.v) >= _mod) v -= _mod; }
        public void Sub(Mod x) { if ((v -= x.v) < 0) v += _mod; }
        public void Mul(Mod x) => v = (v * x.v) % _mod;
        public void Div(Mod x) => v = (v * Inverse(x.v)) % _mod;
        static public Mod operator +(Mod x, Mod y) { var t = x.v + y.v; return t >= _mod ? new Mod { v = t - _mod } : new Mod { v = t }; }
        static public Mod operator -(Mod x, Mod y) { var t = x.v - y.v; return t < 0 ? new Mod { v = t + _mod } : new Mod { v = t }; }
        static public Mod operator *(Mod x, Mod y) => x.v * y.v;
        static public Mod operator /(Mod x, Mod y) => x.v * Inverse(y.v);
        static public bool operator ==(Mod x, Mod y) => x.v == y.v;
        static public bool operator !=(Mod x, Mod y) => x.v != y.v;
        static public long Inverse(long x) { long b = _mod, r = 1, u = 0, t = 0; while (b > 0) { var q = x / b; t = u; u = r - q * u; r = t; t = b; b = x - q * b; x = t; } return r < 0 ? r + _mod : r; }
        public bool Equals(Mod x) => v == x.v;
        public bool Equals(long x) => v == x;
        public override bool Equals(object x) => x == null ? false : Equals((Mod)x);
        public override int GetHashCode() => v.GetHashCode();
        public override string ToString() => v.ToString();
        static List<Mod> _fact = new List<Mod>() { 1 };
        static void B(long n) { if (n >= _fact.Count) for (int i = _fact.Count; i <= n; ++i) _fact.Add(_fact[i - 1] * i); }
        static public Mod Comb(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)] / _fact[(int)k]; }
        static public Mod Perm(long n, long k) { B(n); if (n == 0 && k == 0) return 1; if (n < k || n < 0) return 0; return _fact[(int)n] / _fact[(int)(n - k)]; }
    }
}


Measured memory_bytes: 13504