问题 BM: 奥列格和股价

内存限制:256 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:14 通过:8

题目描述

银行客户奥列格每天检查股价。他对n个股价感兴趣。今天,他观察到,这些股票中,每一秒都会有一支股票的价格减少k卢布(请注意,每一秒只有一支股票的价格会变化,但在不同的秒,不同的价格会变化)。价格可能变成负值。奥列格发现这个过程很有趣,他问金融分析师伊戈尔,所有n支股票的价格全部相等所需的最短时间是多少,或者根本不可能?伊戈尔现在很忙,所以他请你帮奥列格。你能回答这个问题吗?

输入格式

第一行包含两个整数n和k(1≤n≤10^5,1≤k≤10^9)− 股票价格的数量,以及卢布价格的数量每秒都在下降。

第二行包含n个整数a1,a2,…,an(1≤ai≤10^9)− 初始价格。

输出格式

打印包含价格相等所需的最小秒数的唯一一行,如果不可能,则打印«-1»。

示例



Input
3 3
12 9 15
Output
3
Input
2 2
10 9
Output
-1
Input
4 1
1 1000000000 1000000000 1000000000
Output
2999999997
Note
Consider the first example.
Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.
There could be other possibilities, but this minimizes the time needed for all prices to become equal. Thus the answer is 3.
In the second example we can notice that parity of first and second price is different and never changes within described process. Thus prices never can become equal.
In the third example following scenario can take place: firstly, the second price drops, then the third price, and then fourth price. It happens 999999999 times, and, since in one second only one price can drop, the whole process takes 999999999*3=2999999997 seconds. We can note that this is the minimum possible time.




输入样例 复制

3 3

12 9 15

输出样例 复制

3