#include <bits/stdc++.h>
using namespace std;
const long long maxn = 100001;
long long tot = 0;
long long rt;
struct fhq {
  long long ch[maxn][2], val[maxn], rnd[maxn], size[maxn];
  void upt(long long x) { size[x] = size[ch[x][1]] + size[ch[x][0]] + 1; }
  long long newnode(long long x) {
    ++tot;
    val[tot] = x;
    rnd[tot] = rand();
    size[tot] = 1;
    return tot;
  }
  void split(long long u, long long k, long long &x, long long &y) {
    if (!u) {
      x = 0;
      y = 0;
      return;
    } else if (val[u] <= k) {
      x = u;
      split(ch[u][1], k, ch[u][1], y);
    } else {
      y = u;
      split(ch[u][0], k, x, ch[u][0]);
    }
    upt(u);
  }
  long long merge(long long a, long long b) {
    if (!a || !b) return a + b;
    if (rnd[a] < rnd[b]) {
      ch[a][1] = merge(ch[a][1], b);
      upt(a);
      return a;
    } else {
      ch[b][0] = merge(a, ch[b][0]);
      upt(b);
      return b;
    }
  }
  void insert(long long a) {
    long long x, y;
    split(rt, a, x, y);
    rt = merge(merge(x, newnode(a)), y);
  }
  void del(long long a) {
    long long x, y, z;
    split(rt, a, x, y);
    split(x, a - 1, x, z);
    z = merge(ch[z][0], ch[z][1]);
    rt = merge(merge(x, z), y);
  }
  long long kth(long long u, long long k) {
    while (1) {
      if (k <= size[ch[u][0]])
        u = ch[u][0];
      else {
        if (k == size[ch[u][0]] + 1)
          return val[u];
        else {
          k -= size[ch[u][0]] + 1;
          u = ch[u][1];
        }
      }
    }
  }
  long long rk(long long a) {
    long long x, y;
    split(rt, a - 1, x, y);
    long long ans = size[x] + 1;
    rt = merge(x, y);
    return ans;
  }
  long long l_b(long long x) {
    long long a, b;
    split(rt, x - 1, a, b);
    long long ans = kth(a, size[a]);
    rt = merge(a, b);
    return ans;
  }
  long long u_b(long long x) {
    long long a, b;
    split(rt, x, a, b);
    long long ans = kth(b, 1);
    rt = merge(a, b);
    return ans;
  }
} Tree;
signed main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= m; ++i) {
    long long k;
    cin >> k;
    long long z = n * 2 - k;
    long long aa = z & (-z);
    cout << n - (z / aa + -1) / 2 << endl;
  }
}
