#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x7FFFFFFF7FFFFFFF;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, q, p;
  cin >> n >> q;
  while (q--) {
    cin >> p;
    long long l, r;
    l = 0;
    r = n;
    while (p % 2 == 0) {
      long long s = (r - p) + (p - l - 1) / 2;
      p = s + p + 1;
      long long temp = r;
      long long leap = (r - l) / 2;
      if (l % 2 and r % 2 == 0) leap += 1;
      r = r + leap;
      l = temp;
    }
    long long ans = (p + 1) / 2;
    cout << ans << endl;
  }
  return 0;
}
