n, m = map(int, input().split())
a = list(map(int, input().split()))
del a[0]
if n != 1:
  for i in range(n-1):
    b = list(map(int, input().split()))
    del b[0]
    a = a+b
    a = [x for x in set(a) if a.count(x) > 1]
print(len(a)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split del a[0] a[0] a 0 if n != 1:
  for i in range(n-1):
    b = list(map(int, input().split()))
    del b[0]
    a = a+b
    a = [x for x in set(a) if a.count(x) > 1] n != 1 n 1 for i in range(n-1):
    b = list(map(int, input().split()))
    del b[0]
    a = a+b
    a = [x for x in set(a) if a.count(x) > 1] i range(n-1) range n-1 n 1 b = list(map(int, input().split())) b list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split del b[0] b[0] b 0 a = a+b a a+b a b x for x in set(a) if a.count(x) > 1 for x in set(a) if a.count(x) > 1 x set(a) set a a.count(x) > 1 a.count(x) a.count a count x 1 if a.count(x) > 1 x a = [x for x in set(a) if a.count(x) > 1] a [x for x in set(a) if a.count(x) > 1] print(len(a)) print len(a) len a n, m = map(int, input().split()) map(int, input().split()) n a = list(map(int, input().split())) list(map(int, input().split())) a a = [x for x in set(a) if a.count(x) > 1] [x for x in set(a) if a.count(x) > 1] a a = a+b a+b a m = map(int, input().split()) map(int, input().split()) m b = list(map(int, input().split())) list(map(int, input().split())) b
n, m = map(int, input().split())
a = list(map(int, input().split()))
del a[0]
if n != 1:
  for i in range(n-1):
    b = list(map(int, input().split()))
    del b[0]
    a = a+b
    a = [x for x in set(a) if a.count(x) > 1]
print(len(a))