#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int vis[(1 << 21)], ans[(1 << 21)];
vector<int> v;
void solve() {
  int n, q;
  cin >> n >> q;
  ans[0] = 1;
  vis[0] = 1;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (vis[x]) {
      ans[i] = (2 * ans[i - 1]) % MOD;
    } else {
      int m = v.size();
      for (int j = 0; j < m; j++) {
        v.push_back(x ^ v[j]);
        vis[x ^ v[j]] = i;
      }
      v.push_back(x);
      vis[x] = i;
      ans[i] = ans[i - 1];
    }
  }
  for (int i = 1; i <= q; i++) {
    int l, x;
    cin >> l >> x;
    if (vis[x] == 0) vis[x] = n + 1;
    if (vis[x] <= l)
      cout << ans[l] << '\n';
    else
      cout << 0 << '\n';
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
