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.

makeitdonesolo | 64 |

ShubhamJain18 | 64 |

Bishnu Dev Panda | 54 |

DanishBansal | 50 |

abhithakur588 | 50 |

Bishnu Dev Panda | 777 |

yk12 | 512 |

okayboss | 490 |

DevMittal | 472 |

VijethaShastri | 431 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.