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