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