#include <bits/stdc++.h>
using namespace std;
template <typename Q>
void inin(Q &x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x = f ? -x : x;
}
unsigned long long n;
int q;
unsigned long long js(unsigned long long x) {
  unsigned long long xx = x / 2;
  xx = n - xx;
  unsigned long long ret = x;
  while ((xx & 1) == 0) {
    ret += xx;
    xx /= 2;
  }
  return (ret + xx + 1) / 2;
}
int main() {
  inin(n), inin(q);
  while (q--) {
    unsigned long long x;
    inin(x);
    if (x & 1)
      printf("%lld\n", (x + 1) / 2);
    else
      printf("%lld\n", js(x));
  }
  return 0;
}
