import java.util.Scanner;

public class C556C {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int n = input.nextInt();
    int k = input.nextInt();
    int[][] d = new int[k][];
    for(int i = 0; i < k; i++) {
      int size = input.nextInt();
      d[i] = new int[size];
      for(int j = 0; j < size; j++) {
        d[i][j] = input.nextInt();
      }
    }

    boolean skip = false;
    int l = 1;
    for(int i = 0; i < k && !skip; i++) {
      for(int j = 0; j < d[i].length && !skip; j++) {
        if(d[i][j] == 1) {
          int m = j + 1;
          for(; m < d[i].length && d[i][m] == d[i][m - 1] + 1; m++);
          l = m - j;
          skip = true;
        }
      }
    }
    System.out.println((2 * n) - k - (2 * l) + 1);
  }
}
