407681: GYM102873 A Catching the Impostor

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Catching the Impostortime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

There are $$$n$$$ players, numbered from $$$1$$$ to $$$n$$$. They are playing "Among Us" and exactly one of them is a hidden impostor. The remaining players need to do tasks around the spaceship and catch the impostor.

Some players were already seen doing a task so they can't be an impostor. You're given a list of values $$$x_i$$$, each denoting a player who did a task. The list might contain duplicates.

Players win if they kick the impostor out of the spaceship. But can they be sure who the impostor is? Print YES if the given list uniquely determines who the impostor is, and NO otherwise.

If the list contains all $$$n$$$ players, then apparently there's a mistake and the impostor faked a task. It's impossible to catch him or her, so you need to print NO. (If the list doesn't contain all players then we don't consider the possibility of faking a task.)

Input

The first line contains two integers $$$n$$$ $$$(2 \leq n \leq 1000)$$$ and $$$k$$$ $$$(1 \leq k \leq 1000)$$$ — the number of players and the size of the list.

The second line contains $$$k$$$ space separated integers $$$x_1, x_2, \ldots, x_k$$$ ($$$1 \leq x_i \leq n$$$) — players who did a task and thus can't be the impostor. The values $$$x_i$$$ don't need to be distinct.

Output

Output YES if players can be certain about who the impostor is, and NO otherwise.

ExamplesInput
3 3
1 2 2
Output
YES
Input
4 2
3 1
Output
NO
Input
3 5
2 1 1 3 3
Output
NO
Input
2 2
2 2
Output
YES
Note

In the first sample test, there are three players, numbered $$$1$$$, $$$2$$$ and $$$3$$$. Players $$$1$$$ and $$$2$$$ did at least one task each. Only player $$$3$$$ can be the impostor.

In the second test, players $$$1$$$ and $$$3$$$ did a task, which leaves players $$$2$$$ and $$$4$$$ as potential impostors. Players can't be certain who the impostor is so the answer is NO.

In the third test, all players were apparently seen doing a task so players can't catch the sneaky impostor.

In the fourth test, player $$$2$$$ did many tasks and player $$$1$$$ must be the impostor.

加入题单

算法标签: