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