#include <bits/stdc++.h>
using namespace std;
int a[10000];
int main() {
  ios_base::sync_with_stdio(0);
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long x;
    cin >> x;
    if (x % 2)
      cout << (x + 1) / 2 << endl;
    else {
      long long mv = n - x / 2;
      long long id = x;
      while (mv) {
        id += mv;
        if (mv % 2) break;
        mv /= 2;
      }
      cout << (id + 1) / 2 << endl;
    }
  }
}
