#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, x;
  cin >> n >> k;
  while (k--) {
    scanf("%lld", &x);
    if (x & 1)
      printf("%lld\n", x / 2 + 1);
    else {
      long long m = n;
      while (x % 2 == 0) {
        x = m - x / 2;
        m = x;
      }
      printf("%lld\n", n - x + (x + 1) / 2);
    }
  }
  return 0;
}
