{"raw_statement":[{"iden":"statement","content":"DreamGrid has a paper strip with $n$ grids in a line and he has drawn some beautiful patterns in some grids. Unfortunately, his naughty roommate BaoBao drew some other patterns in some other grids when he wasn't at home. Now DreamGrid has to erase BaoBao's patterns without destroying his own patterns.\n\nLet's number the grids from 1 to $n$ from left to right. Each grid either contains DreamGrid's pattern, or contains BaoBao's pattern, or is empty.\n\nEach time, DreamGrid can select two integers $l$ and $r$ (these two integers can be different each time) such that\n\n- $1 \\le l \\le r \\le n$, and\n- for all $l \\le i \\le r$, the $i$-th grid either contains BaoBao's pattern, or is empty,\n\nand change the $i$-th grid to an empty grid for all $l \\le i \\le r$.\n\nHow many ways can DreamGrid change all the grids containing BaoBao's pattern to empty grids by performing the above operation exactly $m$ times? As the answer may be large, please print the answer modulo $10^9 + 7$.\n\nLet $\\{(a_1, b_1), (a_2, b_2), \\dots (a_m, b_m)\\}$ be a valid erasing sequence ($1 \\le a_i \\le b_i \\le n$), where $(a_i, b_i)$ indicates that DreamGrid selects integers $a_i$ and $b_i$ in the $i$-th operation. Let $\\{(c_1, d_1), (c_2, d_2), \\dots, (c_m, d_m)\\}$ be another valid erasing sequence ($1 \\le c_i \\le d_i \\le n$), where $(c_i, d_i)$ indicates that DreamGrid selects integers $c_i$ and $d_i$ in the $i$-th operation. These two sequences are considered different, if there exists an integer $k$ ($1 \\le k \\le m$) such that $a_k \\ne c_k$ or $b_k \\ne d_k$."},{"iden":"input","content":"There are multiple test cases. The first line of the input contains an integer $T$ ($1 \\le T \\le 1000$), indicating the number of test cases. For each test case:\n\nThe first line contains two integers $n$ and $m$ ($1 \\le n \\le 100$, $1 \\le m \\le 10^9$), indicating the number of grids and the number of times to perform the operation.\n\nThe second line contains $n$ integers $a_i$ ($a_i \\in \\{0, 1, 2\\}$).\n\n- If $a_i = 0$, the $i$-th grid is empty.\n- If $a_i = 1$, the $i$-th grid contains DreamGrid's pattern.\n- If $a_i = 2$, the $i$-th grid contains BaoBao's pattern.\n\nIt's guaranteed that at most 50 test cases have $n > 50$."},{"iden":"output","content":"For each test case, output one line containing the number of ways modulo $10^9 + 7$."}],"translated_statement":null,"sample_group":[["3\n2 2\n2 0\n3 2\n2 1 0\n3 1\n2 1 0","8\n3\n1"]],"show_order":[],"formal_statement":null,"simple_statement":null,"has_page_source":false}