#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e9 + 7;
const int N = 1e5 + 7;
const int M = 5e6 + 7;
const int mod = 1e9 + 7;
int n, q;
int fac[N], b[N][30], cnt[N];
bool judge(int l, int x) {
  for (int i = 20; ~i; --i)
    if (x & (1 << i)) {
      if (!b[l][i]) return 0;
      x ^= b[l][i];
    }
  return x == 0;
}
void build() {
  fac[0] = 1;
  for (int i = 1; i < N; i++) fac[i] = (fac[i - 1] << 1) % mod;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 20; j++) b[i][j] = b[i - 1][j];
    cnt[i] = cnt[i - 1];
    int x;
    cin >> x;
    for (int j = 20; ~j; --j)
      if (x & (1 << j)) {
        if (!b[i][j]) {
          b[i][j] = x;
          cnt[i]++;
          break;
        } else
          x ^= b[i][j];
      }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> q;
  build();
  while (q--) {
    int l, x;
    cin >> l >> x;
    if (judge(l, x))
      cout << fac[l - cnt[l]] << "\n";
    else
      cout << "0\n";
  }
  return 0;
}
