Japanese Crosswords Strike Back

题意翻译

一维日本填字游戏可以表示成一个长度为x的二进制字符串。其填字编码一个大小为$n$ 的数组$a$ ,其中$n$ 是完全由1组成的子串的数量,$a_i$ 是第i个子串的长度。没有两个子串接触或相交。 例如: 如果$x = 6$ 且填字是$111011$ ,那么它的编码是一个数组${3,2}$ ; 如果$x = 8$ 且填字是$01101010$ ,那么它的编码是一个数组${2,1,1}$ 。 如果$x = 5$ 并且填字是$11111$ ,那么它的编码是一个数组${5}$ ; 如果$x = 5$ 并且填字是$00000$ ,那么它的编码是一个空数组。 Mishka想要创造一个新的一维日本填字游戏。他已经选择了这个填字游戏的长度和编码。问这个填字是否只有一种情况,而现在他需要检查是否只有一个填字。帮他检查一下! 输入 第一行包含两个整数n和$x(1≤n≤100000,1≤x\leq109)$ 第二行包含n个整数$a_1,a_2,...,a_n(1≤a_i≤10000)$ —— 编码。 输出 如果只存在一种情况输出YES,否则输出NO。 感谢@つるまる 提供的翻译

题目描述

A one-dimensional Japanese crossword can be represented as a binary string of length $ x $ . An encoding of this crossword is an array $ a $ of size $ n $ , where $ n $ is the number of segments formed completely of $ 1 $ 's, and $ a_{i} $ is the length of $ i $ -th segment. No two segments touch or intersect. For example: - If $ x=6 $ and the crossword is $ 111011 $ , then its encoding is an array $ {3,2} $ ; - If $ x=8 $ and the crossword is $ 01101010 $ , then its encoding is an array $ {2,1,1} $ ; - If $ x=5 $ and the crossword is $ 11111 $ , then its encoding is an array $ {5} $ ; - If $ x=5 $ and the crossword is $ 00000 $ , then its encoding is an empty array. Mishka wants to create a new one-dimensional Japanese crossword. He has already picked the length and the encoding for this crossword. And now he needs to check if there is exactly one crossword such that its length and encoding are equal to the length and encoding he picked. Help him to check it!

输入输出格式

输入格式


The first line contains two integer numbers $ n $ and $ x $ ( $ 1<=n<=100000 $ , $ 1<=x<=10^{9} $ ) — the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains $ n $ integer numbers $ a_{1} $ , $ a_{2} $ , ..., $ a_{n} $ ( $ 1<=a_{i}<=10000 $ ) — the encoding.

输出格式


Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.

输入输出样例

输入样例 #1

2 4
1 3

输出样例 #1

NO

输入样例 #2

3 10
3 3 2

输出样例 #2

YES

输入样例 #3

2 10
1 3

输出样例 #3

NO