#include <bits/stdc++.h>
using namespace std;
int q;
long long n;
long long read() {
  long long x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x;
}
long long Get(long long N, long long P) {
  if (P & 1) return (P + 1) / 2;
  if (N % 2 == 0)
    return (N + 1) / 2 + Get(N / 2, P / 2);
  else if (P > 2)
    return (N + 1) / 2 + Get(N / 2, P / 2 - 1);
  else
    return (N + 1) / 2 + Get(N / 2, N / 2);
}
int main() {
  scanf("%I64d%d", &n, &q);
  while (q--) printf("%I64d\n", Get(n, read()));
  return 0;
}
