#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long a[110]; int main() { long long n, k; cin >> n >> k; for (int i = 0; i < k; i++) { cin >> a[i]; } bool b = false, b1 = false; bool b2 = false, b3 = false; bool b4 = false, b5 = false; for (int i = 0; i < k; i++) { if (b1 && a[i] % 6 == 0) { b = true; } if (a[i] % 6 == 1) { b1 = true; } if (a[i] % 6 == 2) { b2 = true; } if (a[i] % 6 == 3) { b3 = true; } if (b3 && a[i] % 6 == 4) { b4 = true; } if (b2 && a[i] % 6 == 5) { b5 = true; } } if (b || b4 || b5) { cout << "No" << endl; } else { cout << "Yes" << endl; } return 0; }