N, M = map(int, input().split())
Foods = [0]*(M+1)
for i in range(N):
    K = list(map(int, input().split()))
    for j in range(1, K[0]+1):
        Foods[K[j]] += 1
cnt = 0
for i in range(M+1):
    if Foods[i] == N:
        cnt += 1
print(cnt) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M Foods = [0]*(M+1) Foods [0]*(M+1) [0] 0 M+1 M 1 for i in range(N):
    K = list(map(int, input().split()))
    for j in range(1, K[0]+1):
        Foods[K[j]] += 1 i range(N) range N K = list(map(int, input().split())) K list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in range(1, K[0]+1):
        Foods[K[j]] += 1 j range(1, K[0]+1) range 1 K[0]+1 K[0] K 0 1 Foods[K[j]] += 1 Foods[K[j]] Foods K[j] K j 1 cnt = 0 cnt 0 for i in range(M+1):
    if Foods[i] == N:
        cnt += 1 i range(M+1) range M+1 M 1 if Foods[i] == N:
        cnt += 1 Foods[i] == N Foods[i] Foods i N cnt += 1 cnt 1 print(cnt) print cnt M = map(int, input().split()) map(int, input().split()) M N, M = map(int, input().split()) map(int, input().split()) N K = list(map(int, input().split())) list(map(int, input().split())) K cnt = 0 0 cnt cnt += 1 1 cnt Foods = [0]*(M+1) [0]*(M+1) Foods
N, M = map(int, input().split())
Foods = [0]*(M+1)
for i in range(N):
    K = list(map(int, input().split()))
    for j in range(1, K[0]+1):
        Foods[K[j]] += 1
cnt = 0
for i in range(M+1):
    if Foods[i] == N:
        cnt += 1
print(cnt)