Given a set of m distinct positive integers and a value ‘N’. The problem is to count the total number of ways we can form ‘N’ by doing sum of the array elements. Repetitions and different arrangements are allowed.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains M and N where M denotes the size of the array and we have to find the answer for the number N.

The second line of each test case contains M space separated integers denoting elements of the array A[ ].

**Output:**

Print the answer for each test case in a new line. Since the answer can be quite large output the answer modulo 10^{9}+7.

**Constraints:**

1<= M <=1000

1<= N <=1000

1<= A[ ] <=1000

**Example:**

**Input:**

1

3 7

1 5 6

**Output:**

6

Author: sujnesh

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.

preparecodinginterview_dot_com | 190 |

__murugan__ | 173 |

manvimahajan20 | 140 |

xiaoyan_yunche | 139 |

ShameekAgarwal | 116 |

preparecodinginterview_dot_com | 190 |

__murugan__ | 173 |

manvimahajan20 | 166 |

SoumyaKaushik | 146 |

arpit_anshuman | 140 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.