#include <bits/stdc++.h>
using namespace std;
int main() {
  long long Ans, N, y, x;
  int q, i;
  scanf("%lld%d", &N, &q);
  for (i = 1; i <= q; ++i) {
    scanf("%lld", &x);
    if ((x & 1) == 1) {
      Ans = (x + 1) >> 1;
      printf("%lld\n", Ans);
    } else {
      y = N - (x / 2);
      x = x + y;
      y = y / 2LL;
      while ((x & 1) == 0) {
        x = x + y;
        y = y / 2LL;
      }
      Ans = (x + 1) >> 1;
      printf("%lld\n", Ans);
    }
  }
  return 0;
}
