#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long x = 0, t = 1;
  register char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = -1, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return x * t;
}
long long n, Q;
long long Calc(long long x) {
  if (x & 1) return (x + 1) / 2;
  return Calc(n - x / 2 + x);
}
int main() {
  n = read();
  Q = read();
  while (Q--) printf("%I64d\n", Calc(read()));
  return 0;
}
