#include <bits/stdc++.h>
long long x, n, q;
int main() {
  for (scanf("%lld%d", &n, &q); q--; printf("%lld\n", x + 1 >> 1))
    for (scanf("%lld", &x); !(x & 1); x += n - x / 2)
      ;
  return 0;
}
