#include<stdio.h>

int main(void){
    int N,K;
    int index[100][100];
    int i,j,t,count;

    for(N=0;N<100;N++){
        for(K=0;K<100;K++){
            index[N][K] = 0;
        }
    }
    scanf("%d %d",&N,&K);

    for (i=0;i<K;i++){
        scanf("%d",&t);
        for (j = 0;j<t;j++){
            scanf("%d",&index[i][j]);
        }
    }

    count = 0;
    for (i=0;i<N;i++){
        t = 0;
        for (j=0;j<K;j++){
            t = index[j][i] + t;
        }
        if (t == 0) count++;

    }

    printf("%d",count);

    return 0;
}