#include <iostream>

using namespace std;

int main()
{
    int n, k;
    bool a[110];
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        a[i] = 0;
    }
    for (int i = 0; i < k; i++)
    {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++)
        {
            int x;
            cin >> x;
            a[x-1] |= 1;
        }
    }
    int s = 0;

    for (int i = 0; i < n; i++)
    {
        s += a[i];
    }
    cout << s << endl;
    return 0;
}