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