#include <bits/stdc++.h>
using namespace std;
const int mac = 2e5 + 10;
int main(int argc, char const *argv[]) {
  long long n, q;
  scanf("%lld%lld", &n, &q);
  while (q--) {
    long long x;
    scanf("%lld", &x);
    if (x & 1)
      printf("%lld\n", (x + 1) >> 1LL);
    else {
      long long ans = 0, n1 = n;
      while (!(x & 1)) {
        long long m = x / 2;
        x = n1 - m;
        n1 -= m;
        ans += m;
      }
      printf("%lld\n", ans + ((x + 1) >> 1LL));
    }
  }
  return 0;
}
