{
TASK: food
LANG:PASCAL
}

type
 tn = 1..75; {h}
 tm = 1..75; {p}
 tx = 1..1000000; {x}
 tpn = 1..10;  {ph}
 txs = {}LongInt{tx};

 tp = record
       p : tx;
       f : tn;
       pn : array[tpn] of tn;
      end;

var
 n, i : tn;
 m, j : tm;
 k : tpn;
 f : array[tn] of tx;
 p : array[tm] of tp;
 mo : array[tm] of txs;
 s : txs;
 pu : array[tm] of byte;
 hu, hu1 : array[tn] of byte;

function find(x : tm): txs;
var r1, r2 : txs;
 i : tn;
 s1 : txs;
Begin
 if x<1 then
 Begin
  find := s;
  exit;
 end;

 {r := 0;}

 pu[x] := 0;
 r1 := find(x-1);

 fillchar(hu1, sizeof(hu1), 0); s1 := 0;
 for i := 1 to p[x].f do if hu[hu[p[x].pn[i]]]=0 then
 Begin
  inc(s1, f[hu[p[x].pn[i]]]);
  hu1[hu[p[x].pn[i]]] := 1;
  hu[hu[p[x].pn[i]]] := 1;
 end;

 pu[x] := 1;
 inc(s, p[x].p); dec(s, s1);
 r2 := find(x-1);

 dec(s, p[x].p); inc(s, s1);
 {for i := 1 to n do if hu1[i]=1 then hu[i] := 0;}

 for i := 1 to p[x].f do if hu1[hu[p[x].pn[i]]]=1 then
 Begin
  {dec(s1, f[hu[p[x].pn[i]]]);}
  {hu1[hu[p[x].pn[i]]] := 0;}
  hu[hu[p[x].pn[i]]] := 0;
 end;

 if r1>r2 then find := r1 else find := r2;
end;

Begin
 readln(n, m);
 for i := 1 to n do readln(f[i]);

 for j := 1 to m do
 Begin
  read(p[j].p, p[j].f);
  for k := 1 to p[j].f do read(p[j].pn[k]);
  readln;{}
 end;

 {
 s := 0; for i := 1 to n do u[i] := 0;
 for j := 1 to m do
 Begin
  for i := 1 to n do if u[i]=0 then
  Begin
   u[i] := 1;
   inc(s, f[i]);
  end;
  dec(s, p[j].p);
  mo[j] := s;
 end;
 }

 {s := 0;} {for i := 1 to n do u[i] := 0;}
 fillchar(pu, sizeof(pu), 0);
 fillchar(hu, sizeof(hu), 0);
 s := 0;
 writeln(find(m));
end.