#include <bits/stdc++.h>
using namespace std;
long long n, q;
inline long long lowbit(long long x) { return x & -x; }
inline long long query(long long x) {
  long long t = (n << 1) - x;
  t /= lowbit(t);
  long long k = (2 * n + 1 - t) / 2;
  return k;
}
signed main() {
  scanf("%lld%lld", &n, &q);
  while (q--) {
    long long x;
    scanf("%lld", &x);
    printf("%lld\n", query(x));
  }
}
