#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, inf = (1 << 30);
inline long long in() {
  char ch = getchar();
  long long f = 1, o = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    o = (o << 1) + (o << 3) + ch - '0';
    ch = getchar();
  }
  return f * o;
}
long long n, q;
void solve(long long k) {
  for (long long c = 0; c <= 60; c++) {
    long long o = (1ll << c);
    if ((k + 1 - (2ll * n + 1)) % o == 0) {
      long long ret = (k + 1 - (2ll * n + 1)) / o + 2ll * n + 1;
      if (ret % 2 == 0) {
        printf("%I64d\n", ret / 2);
        return;
      }
    }
  }
}
int main() {
  n = in(), q = in();
  while (q--) {
    long long k = in();
    if (k & 1)
      printf("%I64d\n", (k + 1) >> 1);
    else
      solve(k);
  }
  return 0;
}
