#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  vector<int> calc(vector<int>& nums, vector<pair<int, int>>& qs) {
    int n = nums.size();
    vector<vector<pair<int, int>>> qv(n);
    vector<int> res(qs.size(), 0);
    for (int i = 0; i < qs.size(); ++i) {
      int l = qs[i].first, x = qs[i].second;
      if (l <= 0) {
        res[i] = 0;
        continue;
      }
      qv[l - 1].emplace_back(x, i);
    }
    set<int> seqs;
    seqs.insert(0);
    long long cnt = 1;
    vector<int> tmp(1001000, 0);
    for (int i = 0; i < n; ++i) {
      int a = nums[i];
      bool existA = seqs.count(a) > 0;
      int newCnt = existA ? addM(cnt, cnt) : cnt;
      for (auto& p : qv[i]) {
        int x = p.first, idx = p.second;
        if (existA) {
          if (seqs.count(x) > 0) {
            res[idx] = addM(cnt, cnt);
          } else {
            res[idx] = 0;
          }
        } else {
          if (seqs.count(x) > 0) {
            res[idx] = cnt;
          } else {
            if (seqs.count(x ^ a) > 0) {
              res[idx] = cnt;
            } else {
              res[idx] = 0;
            }
          }
        }
      }
      if (!existA) {
        int size = 0;
        for (auto& num : seqs) {
          tmp[size++] = num ^ a;
        }
        for (int j = 0; j < size; ++j) {
          seqs.emplace(tmp[j]);
        }
      }
      cnt = newCnt;
    }
    return res;
  }

 private:
  const int M = 1e9 + 7;
  long long normalize(long long a) {
    a %= M;
    if (a < 0) {
      a += M;
    }
    return a;
  }
  long long addM(long long a, long long b) { return normalize(a + b); }
  long long mulM(long long a, long long b) { return normalize(a * b); }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Solution sol;
  int n, q;
  cin >> n >> q;
  vector<int> nums(n);
  for (int i = 0; i < n; ++i) {
    cin >> nums[i];
  }
  vector<pair<int, int>> qs;
  qs.reserve(q);
  for (int i = 0, l = 0, x = 0; i < q; ++i) {
    cin >> l >> x;
    qs.emplace_back(l, x);
  }
  auto res = sol.calc(nums, qs);
  for (auto r : res) {
    cout << r << endl;
  }
  return 0;
}
