N, M = map(int, input().split()) s = [int(input(), 2) for _ in range(M)] st = set(s) ok = True if 0 not in st or (1<