n, m = map(int, input().split())

X = {i for i in range(1, m+1)}
for i in range(n):
    k, *A = map(int, input().split())
    X = X & set(A)
print(len(X)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m i for i in range(1, m+1) for i in range(1, m+1) i range(1, m+1) range 1 m+1 m 1 for i in range(1, m+1) i X = {i for i in range(1, m+1)} X for i in range(n):
    k, *A = map(int, input().split())
    X = X & set(A) i range(n) range n k, *A = map(int, input().split()) k map(int, input().split()) map int input().split() ().split () input split *A A X = X & set(A) X X & set(A) X set(A) set A print(len(X)) print len(X) len X n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m X = X & set(A) X & set(A) X k, *A = map(int, input().split()) map(int, input().split()) k X = {i for i in range(1, m+1)} X
n, m = map(int, input().split())

X = {i for i in range(1, m+1)}
for i in range(n):
    k, *A = map(int, input().split())
    X = X & set(A)
print(len(X))