n,m = map(int, input().split())
ka = [list(map(int, input().split())) for _ in range(n)]

nums = [0]*m
for i in ka:
  for j in range(1,i[0]+1):
    nums[i[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 list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ka = [list(map(int, input().split())) for _ in range(n)] ka [list(map(int, input().split())) for _ in range(n)] nums = [0]*m nums [0]*m [0] 0 m for i in ka:
  for j in range(1,i[0]+1):
    nums[i[j]-1] += 1 i ka for j in range(1,i[0]+1):
    nums[i[j]-1] += 1 j range(1,i[0]+1) range 1 i[0]+1 i[0] i 0 1 nums[i[j]-1] += 1 nums[i[j]-1] nums i[j]-1 i[j] i j 1 1 print(nums.count(n)) print nums.count(n) nums.count nums count n ka = [list(map(int, input().split())) for _ in range(n)] [list(map(int, input().split())) for _ in range(n)] ka m = map(int, input().split()) map(int, input().split()) m n,m = map(int, input().split()) map(int, input().split()) n nums = [0]*m [0]*m nums
n,m = map(int, input().split())
ka = [list(map(int, input().split())) for _ in range(n)]

nums = [0]*m
for i in ka:
  for j in range(1,i[0]+1):
    nums[i[j]-1] += 1
print(nums.count(n))