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