# validation n, m = map(int, input().split()) x = list(map(int, input().split())) a = [list(map(int, input().split())) for _ in range(n)] st = set() st.add(tuple(x)) assert 2 <= n <= 2 * 10 ** 5 assert 1 <= m <= 10 for i in x: assert 0 <= i < 1 << 16 assert len(a) == n for i in range(n): assert len(a[i]) == m + 1 for j in range(m): assert 0 <= a[i][j] < 1 << 16 assert 0 < a[i][-1] <= 100 st.add(tuple(a[i][:-1])) assert len(st) == n + 1