#include <bits/stdc++.h>
using namespace std;
int static_init = []() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  return 0;
}();
int main() {
  int64_t n, x;
  int q;
  cin >> n >> q;
  while (q-- > 0) {
    cin >> x;
    while (x % 2 == 0) x = x / 2 + n;
    cout << (x + 1) / 2 << '\n';
  }
  return 0;
}
