Given two arrays of integers, write a program to check if a pair of values (one value from each array) exists such that swapping the elements of the pair will make the sum of two arrays equal.

**Input:**

First line of input contains a single integer **T** which denotes the number of test cases. T test cases follows. First line of each test case contains two space separated integers **N** and **M**. Second line of each test case contains N space separated integers denoting the elements of first array. Third line of each test case contains M space separated integers denoting the elements of second array.

**Output:**

For each test case, print **1** if there exists any such pair otherwise print **-1**.

**Constraints:**

1<=T<=100

1<=N<=10000

1<=M<=10000

**Example:
Input:**

2

6 4

4 1 2 1 1 2

3 6 3 3

4 4

5 7 4 6

1 2 3 8

1

1

Author: harsh.agarwal0

svashish305 | 54 |

atharvaskant | 39 |

Abhishek Sourya | 30 |

Mr_Bean | 26 |

Shubham Pareek | 26 |

kinetic | 317 |

yirans | 278 |

kevinyu102589 | 263 |

rutvik29 | 209 |

kyaba-kun | 202 |

akhayrutdinov | 4913 |

Ibrahim Nash | 4429 |

Quandray | 4260 |

sanjay05 | 3668 |

GB11 | 2857 |

Login to report an issue on this page.