1816: 【CSP数组】第K大与第K小数█

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:17 Solved:7

Description

给定一个长度为 lns="http://www.w3.org/1998/Math/MathML">N ( lns="http://www.w3.org/1998/Math/MathML">0<n10000 )的序列,保证每一个序列中的数字 lns="http://www.w3.org/1998/Math/MathML">a[i] 是正整数 ,编程要求求出整个序列中第 lns="http://www.w3.org/1998/Math/MathML">k 大的数字减去第 lns="http://www.w3.org/1998/Math/MathML">k 小的数字的值 lns="http://www.w3.org/1998/Math/MathML">m ,并判断 lns="http://www.w3.org/1998/Math/MathML">m 是否为质数。(lns="http://www.w3.org/1998/Math/MathML">0<kn)

Input

输入格式:

第一行为 lns="http://www.w3.org/1998/Math/MathML">2 个数 lns="http://www.w3.org/1998/Math/MathML">nk(含义如上题);

第二行为 lns="http://www.w3.org/1998/Math/MathML">n 个数,表示这个序列。

Output

输出格式:

如果 lns="http://www.w3.org/1998/Math/MathML">m 为质数,则第一行为YES,第二行为这个数 lns="http://www.w3.org/1998/Math/MathML">m;

否则 ,第一行为NO ,第二行为这个数 lns="http://www.w3.org/1998/Math/MathML">m

Sample Input Copy

5 2
1 2 3 4 5 

Sample Output Copy

YES
2