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