n, m = [int(x) for x in input().split()]
a = {i : 0 for i in range(1, m+1)}

for _ in range(n):
  k, *likes = [int(x) for x in input().split()]
  for l in likes:
    a[l] += 1

result = len(list(filter(lambda x : x == n, a.values())))
print(result) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x n, m = [int(x) for x in input().split()] n [int(x) for x in input().split()] m i : 0 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 0 a = {i : 0 for i in range(1, m+1)} a {i : 0 for i in range(1, m+1)} for _ in range(n):
  k, *likes = [int(x) for x in input().split()]
  for l in likes:
    a[l] += 1 _ range(n) range n int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x k, *likes = [int(x) for x in input().split()] k [int(x) for x in input().split()] *likes likes for l in likes:
    a[l] += 1 l likes a[l] += 1 a[l] a l 1 result = len(list(filter(lambda x : x == n, a.values()))) result len(list(filter(lambda x : x == n, a.values()))) len list(filter(lambda x : x == n, a.values())) list filter(lambda x : x == n, a.values()) filter lambda x : x == n x == n x n x a.values() a.values a values print(result) print result result = len(list(filter(lambda x : x == n, a.values()))) len(list(filter(lambda x : x == n, a.values()))) result k, *likes = [int(x) for x in input().split()] [int(x) for x in input().split()] k n, m = [int(x) for x in input().split()] [int(x) for x in input().split()] n m = [int(x) for x in input().split()] [int(x) for x in input().split()] m a = {i : 0 for i in range(1, m+1)} {i : 0 for i in range(1, m+1)} a
n, m = [int(x) for x in input().split()]
a = {i : 0 for i in range(1, m+1)}

for _ in range(n):
  k, *likes = [int(x) for x in input().split()]
  for l in likes:
    a[l] += 1

result = len(list(filter(lambda x : x == n, a.values())))
print(result)