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