#include <bits/stdc++.h>
using namespace std;
long long n, q;
long long k;
long long get_ans() {
  long long mark = 1;
  long long nowk = k;
  long long cnt = 0;
  long long all_size = n;
  while (1) {
    if (!((nowk - mark) & 1)) return cnt + ((nowk - mark) >> 1) + 1;
    cnt += (all_size - mark + 2) >> 1;
    mark = !((all_size - mark) & 1) + 1;
    nowk = (nowk + 1) >> 1;
    all_size = n - cnt;
  }
}
int main() {
  scanf("%I64d %I64d", &n, &q);
  for (long long i = 1; i <= q; i++) {
    scanf("%I64d", &k);
    printf("%I64d\n", get_ans());
  }
}
