n,k = map(int, input().split()) A = list(map(int, input().split())) s = [] for a in A: s.append(a) X = set(A) while s: v = s.pop() for x in range(1, 7): for a in A: if v-x == a-(7-x): #print(v-x) if v-x >= 1: s.append(v-x) X.add(v-x) A.append(v-x) #print(X) #print(X) if 1 in X: print('No') else: print('Yes')