#include <bits/stdc++.h>
int main() {
  long long n, p, a, m;
  while (scanf("%I64d%I64d", &n, &p) != EOF) {
    while (p--) {
      scanf("%I64d", &a);
      if (a % 2 == 1) {
        printf("%I64d\n", (a + 1) / 2);
        continue;
      }
      m = n;
      while (a % 2 == 0) {
        a = m - a / 2;
        m = a;
      }
      printf("%I64d\n", n - a + (a + 1) / 2);
    }
  }
  return 0;
}
