#include <bits/stdc++.h>
long long n, x, l, sum1, sum, t;
int q, al, tot, num;
int main() {
  scanf("%I64d%d", &n, &q);
  al = 2 * n;
  for (int i = 1; i <= q; i++) {
    scanf("%I64d", &x);
    sum = x;
    l = 0;
    t = n;
    if (sum % 2 == 1)
      printf("%I64d\n", sum / 2 + 1);
    else {
      while (sum % 2 != 1) {
        if (l & 1)
          sum = (sum - l + 1) >> 1;
        else
          sum = (sum - l) >> 1;
        l += t;
        t = (2 * n - l) >> 1;
        sum += l;
      }
      printf("%I64d\n", sum / 2 + 1);
    }
  }
}
