#include <bits/stdc++.h>
using namespace std;
long long n, q, x;
long long FinalPos(long long jd) {
  long long b = n - jd, nowpos = 2 * jd - 1, f = (jd - b - 1) * 2;
  if (jd == n) b = 1, f = (jd - b - 1) * 2;
  while (f > 0) {
    nowpos = f;
    jd -= b;
    b += b;
    f = (jd - b - 1) * 2;
  }
  return nowpos;
}
int main() {
  scanf("%lld%lld", &n, &q);
  for (int i = 1; i <= q; i++) {
    scanf("%lld", &x);
    if (x & 1) {
      printf("%lld\n", x / 2 + 1);
      continue;
    }
    long long last = n + 1;
    long long f = x - x / 2 - 1, b = last + f;
    while (b <= 2 * n - 1) {
      x = b;
      last = x + 1;
      f = n - x / 2 - 1;
      b = last + f;
      if (x & 1) break;
    }
    printf("%lld\n", x / 2 + 1);
  }
  return 0;
}
