Question
Echo Pair Distance

You are given an integer array and a target. Among all pairs i < j with a_i+a_j=target, find the minimum index distance j-i. If no pair exists, return -1.

Input

First line: KaTeX can only parse string typed expression.
Second line: KaTeX can only parse string typed expression integers.

Output

Print the minimum valid index distance, or KaTeX can only parse string typed expression.

Example
Input:
6 10

1 9 4 6 3 7
Output:
1
Explanation:
Values 4 and 6 occur at adjacent indices 2 and 3.

Online