#include <bits/stdc++.h>
long long n, x;
int q;
long long solve(long long n, long long x, int sign) {
  if (n == 1) return 1;
  if (sign) {
    if (x & 1) return x + 1 >> 1;
    return (n + 1 >> 1) + solve(n >> 1, x >> 1, n + sign & 1);
  }
  if (x & 1) return (n >> 1) + solve(n + 1 >> 1, x + 1 >> 1, n + sign & 1);
  return x >> 1;
}
int a[233];
int main() {
  scanf("%lld%d", &n, &q);
  while (q--) {
    scanf("%lld", &x);
    printf("%lld\n", solve(n, x, 1));
  }
}
