John is a very calm person. He loves children very much. As his birthday is coming, he decided to give some gifts to the poor children and wants to make them happy by giving them the balls. But his enemy does not like his idea and therefore he wants to destroy John's Plan. So, his enemy takes away the balls as much as he can in the absence of John. John becomes very sad and thinks how he would distribute the remaining balls so that all the children feel happy. Therefore our task is to find the number of ways of distributing the balls. If he can distribute it, output number of ways else print "-1" without quotes.

**Input:**

First line of the input contains an integer **T**, denoting number of test cases. Then T test cases follow. Each test case consists of two lines. The first line of each test case consists of three integers **m, n** and **p** denoting **total number of balls**,** number of children** and the **balls enemy has taken** respectively. The second line of each test case consists of n space separated integers denoting minimum number of balls needed by a child numbered i, where 1<= i <= n.

**Output:**

If he can distribute, print the number of ways **mod 10 ^{9}+7**, else print "

**Constraints:**

1 <= T <= 100

1 <= m <= 1000

2 <= n <= 100

1 <= p <= 1000

**Example:
Input **

2

13 4 5

2 3 1 3

30 10 14

2 2 1 1 1 2 2 3 1 1

**Output**

-1

1

Author: AdityaChatterjee

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.

akhyasharma01 | 467 |

ASWATHAMA | 399 |

john_wick | 360 |

mmzeineddine | 295 |

PiyushPandey4 | 271 |

PiyushPandey4 | 614 |

ASWATHAMA | 561 |

akhyasharma01 | 547 |

john_wick | 521 |

rahulnishad96 | 442 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.