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