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