#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long x;
    cin >> x;
    if (x % 2 == 1)
      cout << x / 2 + 1 << "\n";
    else {
      long long d = 2 * n - x;
      while (d % 2 == 0) d = d / 2;
      cout << n - d / 2 << "\n";
    }
  }
  return 0;
}
