#include <bits/stdc++.h>
using namespace std;
int n, q;
const int mod = 1e9 + 7;
int a[100001];
bool vis[1 << 20];
vector<int> s{0};
int ans[100001];
vector<pair<int, int> > que[100001];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> q;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < q; i++) {
    int l, x;
    cin >> l >> x;
    que[l].push_back({i, x});
  }
  int ret = 1;
  vis[0] = true;
  for (int i = 0; i < n; i++) {
    int t = a[i];
    if (!vis[t]) {
      vis[t] = true;
      int sz = s.size();
      for (int j = 0; j < sz; j++) {
        vis[s[j] ^ t] = true;
        s.push_back(s[j] ^ t);
      }
    } else
      ret *= 2;
    ret %= mod;
    for (auto e : que[i + 1]) ans[e.first] = vis[e.second] * ret;
  }
  for (int i = 0; i < q; i++) cout << ans[i] << '\n';
  return 0;
}
