#include using namespace std; #define x first #define y second #define pb push_back #define eb emplace_back #define rep(i,a,b) for(auto i = (a); i != (b); ++i) #define REP(i,n) rep(i,0,n) #define all(v) (v).begin(), (v).end() template using min_queue = priority_queue, greater>; typedef long long ll; typedef long double ld; typedef pair ii; typedef vector vi; typedef vector vvi; typedef vector vii; const int maxn = 5e5; int N, M, X[maxn], L[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> N >> M; REP(i, N) cin >> X[i]; // remember the differences. for (int i = N - 1; i > 0; i--) { X[i] -= X[i - 1]; } REP(i, M) cin >> L[i]; sort(L, L + M); // match greedily min_queue q; for (int i = 1; i < N; i++) { // i + 1 is the next to add q.emplace(X[i], i + 1); } int ptr = 0; while (!q.empty() && ptr < M) { ii cur = q.top(); q.pop(); if (cur.y < N) { // add the next one. q.emplace(cur.x + X[cur.y], cur.y + 1); } if (L[ptr] >= cur.x) { // we got a match! ptr++; } else { // do not use this one. } } if (ptr == M) cout << "yes" << endl; else cout << "no" << endl; return 0; }