#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, mod = 1e9 + 7;
int n, m, p[N];
vector<int> q[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  p[0] = 1;
  for (int i = 1; i < N; i++) {
    p[i] = (p[i - 1] * 2) % mod;
  }
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    q[i] = q[i - 1];
    for (auto it : q[i]) {
      x = min(x, x ^ it);
    }
    if (!x) {
      continue;
    }
    for (auto &it : q[i]) {
      it = min(it, it ^ x);
    }
    q[i].push_back(x);
    sort(q[i].begin(), q[i].end());
  }
  while (m--) {
    int l, x;
    cin >> l >> x;
    for (auto it : q[l]) {
      x = min(x, x ^ it);
    }
    if (x) {
      cout << "0\n";
    } else {
      cout << p[l - q[l].size()] << "\n";
    }
  }
}
