Given an array of sorted integers. The task is to find the closest value to the given number in array. Array may contain duplicate values.

**Note:** If the difference is same for two values print the value which is greater than the given number.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains two integers N & K and the second line contains N space separated array elements.

**Output:**

For each test case, print the closest number in new line.

**Constraints:**

1<=T<=100

1<=N<=10^{5}

1<=K<=10^{5}

1<=A[i]<=10^{5}

**Example:
Input:**

2

4 4

1 3 6 7

7 4

1 2 3 5 6 8 9

**Output:**

3

5

Shahbazuddin Zaidi | 109 |

SunkyuHwang | 108 |

bhatabhi554 | 104 |

sanu123 | 98 |

cass1 | 91 |

blackshadows | 872 |

SunkyuHwang | 612 |

codechaser | 561 |

Shaurya Khanna | 409 |

JojiJoseph | 396 |

akhayrutdinov | 5041 |

Ibrahim Nash | 4919 |

blackshadows | 4572 |

Quandray | 4346 |

sanjay05 | 3668 |

Login to report an issue on this page.