#include <iostream>
#include <vector>
using namespace std;
const int MOD = 1e9 + 7;
long long mod_pow(long long base, long long exp, long long mod) {
long long result = 1;
while (exp > 0) {
if (exp % 2 == 1) result = (result * base) % mod;
base = (base * base) % mod;
exp /= 2;
}
return result;
}
void solve() {
int N;
long long K;
cin >> N >> K;
vector<int> A(N);
long long total_sum = 0;
for (int i = 0; i < N; ++i) {
cin >> A[i];
total_sum += A[i];
}
if (total_sum < K) {
cout << 0 << endl;
return;
}
int cnt1 = 0;
for (int i = 0; i < N; ++i) {
if (A[i] == 1) cnt1++;
}
long long total_subsets = (mod_pow(2, N, MOD) - 1 + MOD) % MOD;
cout << total_subsets << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while (T--) {
solve();
}
return 0;
}