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