#include <bits/stdc++.h>
using namespace std;
int n, m, tot, a[100010], ans[100010];
vector<pair<int, int> > q[100010];
set<int> s;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1, l, x; i <= m; i++) {
    scanf("%d%d", &l, &x);
    q[l].emplace_back(i, x);
  }
  s.insert(0);
  tot = 1;
  for (int i = 1; i <= n; i++) {
    if (s.count(a[i]))
      tot = 1ll * tot * 2 % 1000000007;
    else {
      vector<int> v;
      for (int u : s) v.push_back(u ^ a[i]);
      for (int u : v) s.insert(u);
    }
    for (auto &p : q[i]) ans[p.first] = s.count(p.second) ? tot : 0;
  }
  for (int i = 1; i <= m; i++) printf("%d\n", ans[i]);
}
