n, m = map(int, input().split())
nums = [0 for num in range(m)] 
for i in range(n):
    k = [int(s) for s in input().split()]
    for j in range(1, len(k)):
        nums[k[j] - 1] += 1
print(nums.count(n)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m 0 for num in range(m) for num in range(m) num range(m) range m for num in range(m) 0 nums = [0 for num in range(m)] nums [0 for num in range(m)] for i in range(n):
    k = [int(s) for s in input().split()]
    for j in range(1, len(k)):
        nums[k[j] - 1] += 1 i range(n) range n int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s k = [int(s) for s in input().split()] k [int(s) for s in input().split()] for j in range(1, len(k)):
        nums[k[j] - 1] += 1 j range(1, len(k)) range 1 len(k) len k nums[k[j] - 1] += 1 nums[k[j] - 1] nums k[j] - 1 k[j] k j 1 1 print(nums.count(n)) print nums.count(n) nums.count nums count n n, m = map(int, input().split()) map(int, input().split()) n nums = [0 for num in range(m)] [0 for num in range(m)] nums m = map(int, input().split()) map(int, input().split()) m k = [int(s) for s in input().split()] [int(s) for s in input().split()] k
n, m = map(int, input().split())
nums = [0 for num in range(m)] 
for i in range(n):
    k = [int(s) for s in input().split()]
    for j in range(1, len(k)):
        nums[k[j] - 1] += 1
print(nums.count(n))
