#include <bits/stdc++.h>
using namespace std;
int q, a[100100], head, tail;
long long n;
long long solve(long long n, long long k) {
  if (k & 1) return (k + 1) / 2;
  if (n & 1)
    if (k == 2)
      return solve(n / 2, n / 2) + (n + 1) / 2;
    else
      return solve(n / 2, k / 2 - 1) + (n + 1) / 2;
  else
    return solve(n / 2, k / 2) + n / 2;
}
int main() {
  scanf("%I64d", &n);
  for (scanf("%d", &q); q--;) {
    long long x;
    scanf("%I64d", &x);
    printf("%I64d\n", solve(n, x));
  }
  return 0;
}
