시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB70292849.123%

문제

N people came to some bank to get their salary of a1, a2, . . . , aN tenge. There are total M banknotes left in the bank with values b1, b2, . . . , bM tenge correspondently.

You need to determine whether bank is able to give exact salary to all people using given banknotes or not.

입력

First line of input file contains two integers N and M — number of people and number of banknotes. Second line contains N integers a1, a2, . . . , aN (1 ≤ ai ≤ 1000) — salary values. Third line contains M integer numbers b1, b2, . . . , bM (1 ≤ bi ≤ 1000) — values of banknotes .

출력

The output file must contain one word «YES», if bank is able to pay salary. In opposite case output «NO».

서브태스크

번호배점제한
119

N = 1, 1 ≤ M ≤ 20

225

1 ≤ N, M ≤ 10

327

1 ≤ N ≤ 20, 1 ≤ M ≤ 14

429

1 ≤ N, M ≤ 20

예제 입력 1

1 5
8
4 2 5 1 3

예제 출력 1

YES

예제 입력 2

2 6
9 10
5 4 8 6 3 11

예제 출력 2

NO

출처

Olympiad > International Zhautykov Olympiad > IZhO 2014 B번

  • 빠진 조건을 찾은 사람: yclock

채점 및 기타 정보

  • 예제는 채점하지 않는다.