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