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