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