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