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