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