Given two sequences, one is increasing sequence a[] and another a normal sequence b[], find the K-th missing element in the increasing sequence which is not present in the given sequence. If no K-th missing element is there output -1

```
Input: a[] = {0, 2, 4, 6, 8, 10, 12, 14, 15};
b[] = {4, 10, 6, 8, 12};
k = 3
Output: 14
Explanation : The numbers from increasing sequence that
are not present in the given sequence are 0, 2, 14, 15.
The 3rd missing number is 14.
```

**Input:**

The first line consists of an integer** T** i.e number of test cases. The first line of each test case consists of three integers **n _{1}**,

**Output:**

Print the **kth** number that is present in 1st array but not in 2nd.

**Constraints: **

1<=T<=100

1<=n1,n2,k,a[i],b[i]<=10000

**Example:
Input:**

1

9 5 3

0 2 4 6 8 10 12 14 15

4 10 6 8 12

**Output:**

14

Author: saksham0751

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

mantan_g | 267 |

tushki | 198 |

aksht7 | 182 |

ayush1101 | 128 |

namansharmacse17 | 110 |

ARUN_PUNDIR | 730 |

manishgupta8497 | 627 |

AMAN__JAIN | 625 |

Abhimanyu_kumar | 562 |

AJ786 | 541 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4584 |

Login to report an issue on this page.