
import java.util.*;
import java.util.LinkedList;

public class tmp {
    public static void main(String [] args){
        Scanner scan = new Scanner(System.in);

        int n=scan.nextInt();
	 int k=scan.nextInt();
	 int summa=0;
	 int z=0;
	 for (int i =1; i <=k; i++) {
		int m=scan.nextInt();
	
	 for(int j=1;j<=m;j++)
		{
		int x=scan.nextInt();
			if(x==j)z++;
		}
	}
	 System.out.println(2*(n-z)-k+1);
        
        
        
       
        
        
        
        
     
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    }

    public static int cl(int x){
        char [] arr = (x+"").toCharArray();
        String tmp = "";
        
        for(int i=0; i<arr.length; i++){
            if(arr[i] != '0')
                tmp += arr[i];
        }
        return Integer.parseInt(tmp);
    }
    
    
    
    
    
    
    
    
    
    
    


    
    
    
    
}

class Pair implements Comparable<Pair>{
    int x,h;
    
    public Pair(int fi, int ti){
        x = fi;
        h = ti;
    }
    
    public int compareTo(Pair p){
        return x < p.x ? -1 : x==p.x ? 0 : 1;
    }
}
