n,m = map(int, input().split())
k = [list(map(int, input().split())) for i in range(n)]
c = 0
for i in range(1,m+1):
    for j in range(n):
        if i not in k[j][1:]:
            break
    else:
        c+=1
print(c) n,m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m list(map(int, input().split())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k = [list(map(int, input().split())) for i in range(n)] k [list(map(int, input().split())) for i in range(n)] c = 0 c 0 for i in range(1,m+1):
    for j in range(n):
        if i not in k[j][1:]:
            break
    else:
        c+=1 i range(1,m+1) range 1 m+1 m 1 for j in range(n):
        if i not in k[j][1:]:
            break
    else:
        c+=1 j range(n) range n if i not in k[j][1:]:
            break
     i not in k[j][1:] i k[j][1:] [j] k j 1: 1 break c+=1 c 1 print(c) print c m = map(int, input().split()) map(int, input().split()) m n,m = map(int, input().split()) map(int, input().split()) n k = [list(map(int, input().split())) for i in range(n)] [list(map(int, input().split())) for i in range(n)] k c = 0 0 c c+=1 1 c
n,m = map(int, input().split())
k = [list(map(int, input().split())) for i in range(n)]
c = 0
for i in range(1,m+1):
    for j in range(n):
        if i not in k[j][1:]:
            break
    else:
        c+=1
print(c)