CF73E.Morrowindows

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya plays The Elder Trolls III: Morrowindows. He has a huge list of items in the inventory, however, there is no limits on the size of things. Vasya does not know the total amount of items but he is sure that are not more than xx and not less than 22 items in his inventory. A new patch for the game appeared to view inventory in nn different modes. Displaying in mode ii is a partition of all inventory items on pages, each of which (except for maybe the last one) shows exactly aia_{i} items. In addition, each mode shows how many pages bib_{i} is in a complete list. Great! Perhaps this information will be enough for Vasya to find the required number. Moreover, it is very interesting, what is the fewest number of modes in which Vasya can see inventory to determine the number of items in it?

Vasya cannot use the information that was received while looking on inventory in some mode for selection of next actions. I. e. Vasya chooses some set of modes first, and then sees all the results and determines the size.

Knowing the number of aia_{i} , xx and assuming that Vasya is very smart, check whether he can uniquely determine the number of items in his inventory, and how many modes he will need to do that if he knows numbers aia_{i} , xx and he is able to know number bib_{i} after viewing items in mode ii .

输入格式

The first line contains two integers nn and xx ( 0<=n<=105,2<=x<=1090<=n<=10^{5},2<=x<=10^{9} ). The second line contains integers aia_{i} ( 1<=ai<=1091<=a_{i}<=10^{9} ). Some numbers among all aia_{i} may be equal.

输出格式

Output the fewest amount of modes required to uniquely determine amount of items in the inventory. If there is no solution output 1-1 .

输入输出样例

  • 输入#1

    2 4
    2 3
    

    输出#1

    2
    
  • 输入#2

    1 4
    2
    

    输出#2

    -1
    

说明/提示

In the second example Vasya is not able to determine items count uniquely because 3 items, as well as 4 items, can be displayed on two pages.

首页