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