#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define llint long long #define inf 1e18 #define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++) #define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++) #define chmin(x, y) (x) = min((x), (y)) #define chmax(x, y) (x) = max((x), (y)) using namespace std; typedef pair P; llint n, k; llint a[105]; bool dp[10000005]; bool calc(vector &vec) { if(vec.size() == 0) return true; llint l = max(0LL, vec.front() - 1000); for(int i = 0; i < vec.size(); i++) vec[i] -= l; llint r = vec.back()+1; for(int i = 0; i <= r+10; i++) dp[r] = false; for(int i = 0; i < vec.size(); i++) dp[vec[i]] = true; for(int i = r; i >= 0; i--){ if(dp[i+1]&&dp[i+6]) dp[i] = true; if(dp[i+2]&&dp[i+5]) dp[i] = true; if(dp[i+3]&&dp[i+4]) dp[i] = true; } //for(int i = 0; i <= r; i++) cout << dp[i]; cout << endl; return !dp[0]; } int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> k; for(int i = 1; i <= k; i++) cin >> a[i], a[i]--; vector vec; for(int i = 1; i <= k; i++){ if(a[i] > a[i-1] + 1000){ if(!calc(vec)){ cout << "No" << endl; return 0; } vec.clear(); } vec.push_back(a[i]); } if(!calc(vec)){ cout << "No" << endl; return 0; } cout << "Yes" << endl; return 0; }