n, m = map(int, (input().split()))
b = []
for _ in range(n):
    a = list(map(int, input().split()))
    b.extend(a[1:])

ans = 0
for i in range(1,31):
    if b.count(i) == n:
        ans += 1
print(ans) n, m = map(int, (input().split())) n map(int, (input().split())) map int input().split() ().split () input split m b = [] b [] for _ in range(n):
    a = list(map(int, input().split()))
    b.extend(a[1:]) _ 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 b.extend(a[1:]) b.extend b extend a[1:] a 1: 1 ans = 0 ans 0 for i in range(1,31):
    if b.count(i) == n:
        ans += 1 i range(1,31) range 1 31 if b.count(i) == n:
        ans += 1 b.count(i) == n b.count(i) b.count b count i n ans += 1 ans 1 print(ans) print ans b = [] [] b m = map(int, (input().split())) map(int, (input().split())) m n, m = map(int, (input().split())) map(int, (input().split())) n ans = 0 0 ans ans += 1 1 ans a = list(map(int, input().split())) list(map(int, input().split())) a
n, m = map(int, (input().split()))
b = []
for _ in range(n):
    a = list(map(int, input().split()))
    b.extend(a[1:])

ans = 0
for i in range(1,31):
    if b.count(i) == n:
        ans += 1
print(ans)