#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
  return x * f;
}
inline long long calc(long long n, long long x) {
  if (n & 1) {
    if (x & 1) return (x + 1) >> 1;
    return calc((n + 1) >> 1, (x >> 1) + 1) + (n >> 1);
  } else {
    if (x == n) return calc(n >> 1, n >> 1) + (n >> 1);
    if (x & 1) return (x + 1) >> 1;
    return calc(n >> 1, x >> 1) + (n >> 1);
  }
}
long long n;
int q;
int main() {
  n = read();
  q = read();
  while (q--) {
    long long x = read();
    cout << calc(n, x) << endl;
  }
  return 0;
}
