import java.util.*;
import java.io.*;

public class ksubset_af implements Runnable {
	public static void main(String[] args) {
		new Thread(new ksubset_af()).start();
	}
	
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof;
	
	public void run() {
		try {
			Locale.setDefault(Locale.US);
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
		} catch (IOException e) {
		} finally {
			out.close();
		}
	}
	
	String nextToken() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch(IOException e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}
	
	int nextInt() {
		return Integer.parseInt(nextToken());
	}
	
	long nextLong() {
		return Long.parseLong(nextToken());
	}
	
	double parseDouble() {
		return Double.parseDouble(nextToken());
	}
	
	String FNAME = "ksubset";
	
	void myAssert(boolean e, String msg) { 
		if (!e) {
			throw new Error(msg);
		}
	}
	
	public void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		int[] s = new int[m];
		for (int i = 0; i < m; i++) {
			s[i] = nextInt();
		}
		
		boolean[][] D = new boolean[m + 1][1 << n];
		
		int[] sum = new int[1 << n];
		for (int i = 0; i < (1 << n); i++) {
			for (int j = 0; j < n; j++) {
				if (((1 << j) & i) != 0) {
					sum[i] += a[j];
				}
			}
		}
		                    
		D[0][0] = true;
		for (int i = 1; i <= m; i++) {
			for (int j = 1; j < (1 << n); j++) {
				if (sum[j] == s[i - 1]) {
					for (int k = 0; k < (1 << n); k++) {
						if ((k & j) == 0) {
							D[i][j | k] |= D[i - 1][k];
						}
					}
				}
			}
		}
		
		out.println(D[m][(1 << n)  - 1] ? "YES" : "NO");
	}
	
}
