#include using namespace std; int main() { int n, m, _; cin >> n >> m; if(m > n * (n - 1) / 2) return cout << "no\n", 0; multiset w; vector x(n); for(auto &y : x) cin >> y; while(m--) cin >> _, w.insert(_); int max_v = *w.rbegin(); for(int d = 1; d < n; ++d) { // This will run at most sqrt(2m) times. bool done = true; for(int i = 0, dist; i + d < n; ++i) if((dist = x[i + d] - x[i]) <= max_v) { auto it = w.erase(w.lower_bound(dist)); if(w.empty()) return cout << "yes\n", 0; if(it == w.end()) max_v = *w.rbegin(); done = false; } if(done) break; } cout << "no\n"; }