#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
int n, q, zer, arr[maxn], basis[20];
vector<pii> que[maxn];
ll ans[maxn], p2[maxn];
void add(int a) {
  for (int bit = 19; bit >= 0; bit--) {
    if (a >> bit & 1) {
      if (basis[bit])
        a ^= basis[bit];
      else {
        basis[bit] = a;
        return;
      }
    }
  }
  ++zer;
}
bool can(int first) {
  for (int bit = 19; bit >= 0; bit--) {
    if (first >> bit & 1) first ^= basis[bit];
  }
  return first == 0;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  p2[0] = 1;
  for (int i = 1; i < maxn; i++) p2[i] = p2[i - 1] * 2ll % mod;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  for (int i = 1; i <= q; i++) {
    int l, first;
    cin >> l >> first;
    que[l].push_back({first, i});
  }
  for (int i = 1; i <= n; i++) {
    add(arr[i]);
    for (pii p : que[i]) {
      if (can(p.first)) ans[p.second] = p2[zer];
    }
  }
  for (int i = 1; i <= q; i++) cout << ans[i] << "\n";
  return 0;
}
