#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
bitset<N * 22> H;
vector<pair<int, int> > Q[N];
vector<int> v;
int A[N], ans[N], n, q, i, j, u, x, t;
int main() {
  cin >> n >> q;
  for (i = 1; i <= n; i++) scanf("%d", A + i);
  for (i = 1; i <= q; i++) {
    scanf("%d%d", &j, &x);
    Q[j].push_back(make_pair(x, i));
  }
  H[0] = 1;
  v.push_back(0);
  for (t = i = 1; i <= n; i++) {
    x = A[i];
    if (H[x])
      t = t * 2 % mod;
    else {
      u = v.size();
      for (j = 0; j < u; j++) {
        v.push_back(v[j] ^ x);
        H[v[j] ^ x] = 1;
      }
    }
    for (auto z : Q[i]) ans[z.second] = H[z.first] ? t : 0;
  }
  for (i = 1; i <= q; i++) cout << ans[i] << endl;
  return 0;
}
