#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  scanf("%lld%lld", &n, &q);
  while (q--) {
    long long x;
    scanf("%lld", &x);
    while (x % 2LL == 0LL) x = x / 2LL + n;
    printf("%lld\n", x / 2LL + 1LL);
  }
  return 0;
}
