#P1103D. Professional layer

Professional layer

Description

Cardbluff is popular sport game in Telegram. Each Cardbluff player has ever dreamed about entrance in the professional layer. There are nn judges now in the layer and you are trying to pass the entrance exam. You have a number kk — your skill in Cardbluff.

Each judge has a number aia_i — an indicator of uncertainty about your entrance to the professional layer and a number eie_i — an experience playing Cardbluff. To pass the exam you need to convince all judges by playing with them. You can play only one game with each judge. As a result of a particular game, you can divide the uncertainty of ii-th judge by any natural divisor of aia_i which is at most kk. If GCD of all indicators is equal to 11, you will enter to the professional layer and become a judge.

Also, you want to minimize the total amount of spent time. So, if you play with xx judges with total experience yy you will spend xyx \cdot y seconds.

Print minimal time to enter to the professional layer or 1-1 if it's impossible.

There are two numbers in the first line nn and kk (1n1061 \leq n \leq 10^6, 1k10121 \leq k \leq 10^{12}) — the number of judges and your skill in Cardbluff.

The second line contains nn integers, where ii-th number aia_i (1ai10121 \leq a_i \leq 10^{12}) — the uncertainty of ii-th judge

The third line contains nn integers in the same format (1ei1091 \leq e_i \leq 10^9), eie_i — the experience of ii-th judge.

Print the single integer — minimal number of seconds to pass exam, or 1-1 if it's impossible

Input

There are two numbers in the first line nn and kk (1n1061 \leq n \leq 10^6, 1k10121 \leq k \leq 10^{12}) — the number of judges and your skill in Cardbluff.

The second line contains nn integers, where ii-th number aia_i (1ai10121 \leq a_i \leq 10^{12}) — the uncertainty of ii-th judge

The third line contains nn integers in the same format (1ei1091 \leq e_i \leq 10^9), eie_i — the experience of ii-th judge.

Output

Print the single integer — minimal number of seconds to pass exam, or 1-1 if it's impossible

Sample Input 1

3 6
30 30 30
100 4 5

Sample Output 1

18

Sample Input 2

1 1000000
1
100

Sample Output 2

0

Sample Input 3

3 5
7 7 7
1 1 1

Sample Output 3

-1