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