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