Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_k = [list(map(int, input().split())) for i in range(N)]
a_k.sort()

a_non = []
for i in range(1, len(a_k)):
    if len(a_k[0]) <= 1:
        break

    for j in range(1, len(a_k[0])):
        if a_k[0][j] not in a_k[i][1:]:
            a_non.append(j)

for j in range(len(a_non)):
    a_k[0].pop(a_non[j])


print(len(a_k[0]) - 1)


Fixed submission:
N, M = map(int, input().split())
k = [i[1:] for i in [list(map(int, input().split())) for i in range(N)]]
k_1 = [flatten for inner in k for flatten in inner]
count_k = 0
for i in range(1, M + 1):
    if k_1.count(i) == N:
        count_k += 1

print(count_k)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_k = [list(map(int, input().split())) for i in range(N)]
a_k.sort()

for i in range(1, len(a_k)):
    a_non = []
    if len(a_k[0]) <= 1:
        break

    for j in range(1, len(a_k[0])):
        if a_k[0][j] not in a_k[i][1:]:
            a_non.append(j)

    for j in range(len(a_non)):
        a_k[0].pop(a_non[j])


print(len(a_k[0]) - 1)


Fixed submission:
N, M = map(int, input().split())
k = [i[1:] for i in [list(map(int, input().split())) for i in range(N)]]
k_1 = [flatten for inner in k for flatten in inner]
count_k = 0
for i in range(1, M + 1):
    if k_1.count(i) == N:
        count_k += 1

print(count_k)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_k = [list(map(int, input().split())) for i in range(N)]
a_k.sort()

for i in range(1, len(a_k)):
    a_non = []

    for j in range(1, len(a_k[0])):
        if a_k[0][j] not in a_k[i][1:]:
            a_non.append(j)

    for j in range(len(a_non)):
        a_k[0].pop(a_non[j])
    if len(a_k[0]) <= 1:
        break


print(len(a_k[0]) - 1)


Fixed submission:
N, M = map(int, input().split())
k = [i[1:] for i in [list(map(int, input().split())) for i in range(N)]]
k_1 = [flatten for inner in k for flatten in inner]
count_k = 0
for i in range(1, M + 1):
    if k_1.count(i) == N:
        count_k += 1

print(count_k)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_k = [list(map(int, input().split())) for i in range(N)]
a_k.sort()

for i in range(1, len(a_k)):
    a_non = []

    for j in range(1, len(a_k[0])):
        if a_k[0][j] not in a_k[i][1:]:
            a_non.append(j)

    for j in range(len(a_non)):
        a_k[0].pop(a_non[j])
        if len(a_k[0]) <= 1:
            break


print(len(a_k[0]) - 1)


Fixed submission:
N, M = map(int, input().split())
k = [i[1:] for i in [list(map(int, input().split())) for i in range(N)]]
k_1 = [flatten for inner in k for flatten in inner]
count_k = 0
for i in range(1, M + 1):
    if k_1.count(i) == N:
        count_k += 1

print(count_k)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_k = [list(map(int, input().split())) for i in range(N)]
a_k.sort()

for i in range(1, len(a_k)):
    a_non = []

    for j in range(1, len(a_k[0])):
        if a_k[0][j] not in a_k[i][1:]:
            a_non.append(j)

    for j in range(len(a_non)):
        a_k[0].pop(a_non[j])


print(len(a_k[0]) - 1)


Fixed submission:
N, M = map(int, input().split())
k = [i[1:] for i in [list(map(int, input().split())) for i in range(N)]]
k_1 = [flatten for inner in k for flatten in inner]
count_k = 0
for i in range(1, M + 1):
    if k_1.count(i) == N:
        count_k += 1

print(count_k)