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