#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << ": " << a << " ";
  err(++it, args...);
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vii = vector<pii>;
using vs = vector<string>;
const int DR[] = {-1, 0, 1, 0, -1, 1, 1, -1};
const int DC[] = {0, -1, 0, 1, -1, -1, 1, 1};
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = 1073741823;
const ll INFLL = 4e18;
const int MAX = 1e5;
int N, Q, arr[MAX + 5];
set<int> sets;
int ans[MAX + 5];
vii query[MAX + 5];
vi tmp;
void read() {
  cin >> N >> Q;
  for (int i = (int)1; i <= (int)N; i++) cin >> arr[i];
  for (int i = 0; i < (int)Q; i++) {
    int l, x;
    cin >> l >> x;
    query[l].push_back({x, i});
  }
}
void solve() {
  sets.insert(0);
  ll cnt = 1;
  for (int i = (int)1; i <= (int)N; i++) {
    if (!(sets.find(arr[i]) != sets.end())) {
      tmp.clear();
      for (int x : sets) tmp.push_back(x ^ arr[i]);
      for (int x : tmp) sets.insert(x);
    } else
      cnt = 2 * cnt % MOD;
    for (auto p : query[i]) {
      int x = p.first;
      if ((sets.find(x) != sets.end()))
        ans[p.second] = cnt;
      else
        ans[p.second] = 0;
    }
  }
  for (int i = 0; i < (int)Q; i++) cout << ans[i] << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TC = 1;
  for (int tc = (int)1; tc <= (int)TC; tc++) {
    read();
    solve();
  }
}
