n, m = map(int, input().split())
ans = [0] * m
for i in range(n):
    a = list(map(int, input().split()))
    k = a.pop(0)
    for j in range(k):
        ans[a[j] - 1] += 1
print(ans.count(n)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m ans = [0] * m ans [0] * m [0] 0 m for i in range(n):
    a = list(map(int, input().split()))
    k = a.pop(0)
    for j in range(k):
        ans[a[j] - 1] += 1 i range(n) range n a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k = a.pop(0) k a.pop(0) a.pop a pop 0 for j in range(k):
        ans[a[j] - 1] += 1 j range(k) range k ans[a[j] - 1] += 1 ans[a[j] - 1] ans a[j] - 1 a[j] a j 1 1 print(ans.count(n)) print ans.count(n) ans.count ans count n a = list(map(int, input().split())) list(map(int, input().split())) a k = a.pop(0) a.pop(0) k ans = [0] * m [0] * m ans n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
ans = [0] * m
for i in range(n):
    a = list(map(int, input().split()))
    k = a.pop(0)
    for j in range(k):
        ans[a[j] - 1] += 1
print(ans.count(n))
