#include <bits/stdc++.h>
using namespace std;
using LL = long long;
LL N, Q;
LL N2;
void initN2() {
  int b = 0;
  for (LL x = N; x > 1; x >>= 1) b += 1;
  N2 = 1LL << b;
}
LL _solve2(LL pos) {
  LL headPos = 1, step = 2;
  LL headVal = 1;
  while (headPos <= N2) {
    if ((pos - headPos) % step == 0) return headVal + (pos - headPos) / step;
    headVal += (N2 / step);
    headPos <<= 1;
    step <<= 1;
  }
  throw logic_error("_solve2 doesn't work well!");
}
LL solve(LL pos) {
  if (pos & 1)
    return (pos + 1) >> 1;
  else if (pos > (N - N2) * 2)
    return N - N2 + _solve2(pos - (N - N2) * 2);
  else
    return N - N2 + _solve2((N2 << 1) - N + (pos >> 1));
}
int main() {
  scanf("%lld%lld", &N, &Q);
  initN2();
  while (Q--) {
    LL pos;
    scanf("%lld", &pos);
    printf("%lld\n", solve(pos));
  }
  return 0;
}
