#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, q, x;
  cin >> n >> q;
  while (q--) {
    cin >> x;
    if (x & 1) {
      cout << (x + 1) / 2 << endl;
      continue;
    } else {
      while (!(x & 1)) {
        x = n + (x / 2);
      }
      cout << (x + 1) / 2 << endl;
    }
  }
  return 0;
}
