#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long first, temp;
    cin >> first;
    temp = first;
    while (first % 2 == 0) {
      temp = first / 2;
      first = first + (n - temp);
    }
    cout << (first + 1) / 2 << '\n';
  }
  return 0;
}
