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