#include <bits/stdc++.h>
using namespace std;
int read() {
  char ch = getchar();
  int f = 0, x = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') x = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    f = (f << 1) + (f << 3) + ch - '0';
    ch = getchar();
  }
  return f * x;
}
long long n, q;
long long getans(long long x) {
  if (x & 1LL) return (x / 2LL) + 1;
  return getans(x + n - (x >> 1LL));
}
int main() {
  cin >> n >> q;
  for (int i = 1; i <= q; i++) {
    long long x;
    scanf("%lld", &x);
    printf("%lld\n", getans(x));
  }
}
