#include <stdio.h>
#include <stdlib.h>

void ReadFirstInput(int *snukesNumber, int *candyTypes)
{
    printf_s("Enter the number of Snukes and Snacks: \n");
    scanf("%d %d", snukesNumber, candyTypes);
}

void CountTricks(int *snukesArray, int *snukesNumber)
{
    int counter = 0;
    
    for(int i = 0; i < *snukesNumber; i++)
    {
        if(snukesArray[i] != 1)
        {
            counter++;
        }
    }
    printf_s("%d Snuke(s) had been tricked \n", counter);
}

void CreateArray(int *snukesNumber, int *candyTypes)
{
    int *dArray = malloc(100 * sizeof(int));
    int *aArray =  malloc(100 * 100 * sizeof *aArray);
    int *snukesArray = malloc(100 * sizeof(int));
    
    for(int i = 0; i < *candyTypes; i++)
    {
        scanf("%d\n", &dArray[i]);
        for(int j = 0; j < dArray[i]; j++)
        {
            scanf("%d", &aArray[i + j]);
            int snukesWithSnacks = aArray[i + j];
            snukesArray[snukesWithSnacks - 1] = 1;
        }
    }
    
    CountTricks(snukesArray, snukesNumber);
    free(dArray);
    free(aArray);
    free(candyTypes);
}

int main(void)
{
    int *snukesNumber = malloc(3 * sizeof(int));
    int *candyTypes = malloc(3 * sizeof(int));
    
    ReadFirstInput(snukesNumber, candyTypes);
    CreateArray(snukesNumber, candyTypes);
    
    return 0;
}