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