N,M = map(int, input().split())
an_li = list(map(int, input().split()))
an_li.remove(an_li[0])
for i in range(N-1):
    flag = False
    r = []
    li = list(map(int, input().split()))
    li.remove(li[0])
    for t in an_li:
        if t in li:
            a = 1
        else:
            r.append(t)
            flag = True
    if flag:
        for w in r:
            an_li.remove(w)
print(len(an_li)) N,M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M an_li = list(map(int, input().split())) an_li list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split an_li.remove(an_li[0]) an_li.remove an_li remove an_li[0] an_li 0 for i in range(N-1):
    flag = False
    r = []
    li = list(map(int, input().split()))
    li.remove(li[0])
    for t in an_li:
        if t in li:
            a = 1
        else:
            r.append(t)
            flag = True
    if flag:
        for w in r:
            an_li.remove(w) i range(N-1) range N-1 N 1 flag = False flag False r = [] r [] li = list(map(int, input().split())) li list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split li.remove(li[0]) li.remove li remove li[0] li 0 for t in an_li:
        if t in li:
            a = 1
        else:
            r.append(t)
            flag = True
     t an_li if t in li:
            a = 1
        else:
            r.append(t)
            flag = True
     t in li t li a = 1 a 1 r.append(t) r.append r append t flag = True flag True if flag:
        for w in r:
            an_li.remove(w) flag for w in r:
            an_li.remove(w) w r an_li.remove(w) an_li.remove an_li remove w print(len(an_li)) print len(an_li) len an_li flag = True True flag a = 1 1 a M = map(int, input().split()) map(int, input().split()) M an_li = list(map(int, input().split())) list(map(int, input().split())) an_li N,M = map(int, input().split()) map(int, input().split()) N flag = False False flag r = [] [] r li = list(map(int, input().split())) list(map(int, input().split())) li
N,M = map(int, input().split())
an_li = list(map(int, input().split()))
an_li.remove(an_li[0])
for i in range(N-1):
    flag = False
    r = []
    li = list(map(int, input().split()))
    li.remove(li[0])
    for t in an_li:
        if t in li:
            a = 1
        else:
            r.append(t)
            flag = True
    if flag:
        for w in r:
            an_li.remove(w)
print(len(an_li))