{
TASK: food
LANG:PASCAL
}
var take:Array[1..75] of boolean;
    use:Array[1..75] of boolean;
    aconb:Array[1..75,1..75] of boolean;
    value:Array[1..75] of Longint;
    disc:Array[1..75] of Longint;
    n,m,i,j,l,x,ts,min,minnum:Longint;
function adds(x:Byte):Longint;
var i,t:Longint;
Begin
  t:=0;
 For i:=1 to n do
  if not take[i] and aconb[x,i] then t:=t+value[i];
  adds:=t;
End;
procedure plus(x:Byte);
var i:Byte;
Begin
  use[x]:=true;
  ts:=ts-disc[x];
 For i:=1 to  n do
  if not take[i] and aconb[x,i] then
   Begin
     take[i]:=True;
     ts:=ts+value[i];
   End;
End;
Begin
  ReadLn(n,m);
 For i:=1 to n do ReadLn(value[i]);
 For i:=1 to m do
 Begin
   Read(disc[i]);
   Read(l);
  For j:=1 to l do
   Begin
     Read(x);
     aconb[i,x]:=True;
   End;
 End;
  min:=maxlongint;
  minnum:=0;
 For i:=1 to n do
  if ((adds(i)-disc[i])<=disc[i]) and (adds(i)-disc[i]<min) then
  Begin
    min:=adds(i)-disc[i];
    minnum:=i;
  End;
  if min=maxlongint then
  Begin
    WriteLn('0');
    Exit;
  End;
  plus(minnum);
 For j:=1 to n do
  For i:=1 to n do
   Begin
    If ((adds(i)-disc[i])<disc[i])and(not use[i]) then plus(i);
   End;
 if ts<0 then
 Begin
   WriteLn(abs(ts));
   Exit;
 End
 else
 Begin
   WriteLn('0');
   Exit;
 End;
End.
