#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1E9 + 7;
const long long N = 2E5 + 6;
const long long inf = 1E15;
long long n, q;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("inp.txt", "r")) {
    freopen("inp.txt", "r", stdin);
    freopen("outp.txt", "w", stdout);
  }
  cin >> n >> q;
  long long x;
  while (q--) {
    cin >> x;
    long long z, i = 0;
    if (x & 1) {
      cout << ((x + 1) >> 1) << "\n";
      continue;
    }
    while ((z = (1LL << i)) && (2 * n - x - z) % (2 * z)) {
      i++;
    }
    cout << n - (2 * n - x - z) / (2 * z) << "\n";
  }
  return 0;
}
