#include <bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  ll n, q;
  cin >> n >> q;
  while (q--) {
    ll x;
    cin >> x;
    if (x & 1) {
      cout << (x + 1) / 2 << "\n";
      continue;
    }
    ll cur = n + x / 2;
    ll d = cur - x;
    ll ans = 0;
    while (1) {
      if (cur & 1) {
        ans = (cur + 1) / 2;
        break;
      } else
        cur += (d / 2), d /= 2;
    }
    cout << ans << '\n';
  }
  return 0;
}
