#include<stdio.h>

int main(void){
  int sunuke, okashi, holder, check, tmp;
  int i, j;
  
  scanf("%d" "%d", &sunuke, &okashi);
  check = 0;
  
  for(i = 1;i <= sunuke; i++){
    scanf("%d",&okashi);
    if(check =< okashi){
      check = okashi;
    }
    for(j = 0; j < okashi; j++){
      scanf("%d", &tmp);
    }
  }
  
  sunuke = sunuke - check;
  printf("%d\n", sunuke);
  
  return 0;
}