#include <bits/stdc++.h>
using namespace std;
int k;
long long int n;
int main() {
  scanf("%lld %d", &n, &k);
  long long int tab[k];
  for (int i = 0; i < k; i++) {
    scanf("%lld", &tab[i]);
  }
  for (int j = 0; j < k; j++) {
    if (tab[j] % 2 == 1)
      cout << (tab[j] + 1) / 2 << endl;
    else {
      long long int c = (long long int)tab[j] / 2 + n;
      long long int b = (long long int)c - tab[j];
      while (c % 2 == 0) {
        b = (long long int)b / 2;
        c = (long long int)c + b;
      }
      cout << (c + 1) / 2 << endl;
    }
  }
}
