#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using dbl = long double;
using pii = pair<int, int>;
ll to_pw2(ll n) {
  int b = 63 - __builtin_clzll(n);
  return (n >> b) << b;
}
ll query(ll n, ll x) {
  if (n == 1) return 0;
  if (x % 2 == 0) return x / 2;
  if (n & (n - 1)) {
    ll pw2 = to_pw2(n);
    ll s = n - pw2;
    if (x / 2 < s) return query(pw2, pw2 - s + x / 2) + s;
    return query(pw2, 2 * (x / 2 - s) + 1) + s;
  }
  return query(n / 2, x / 2) + n / 2;
}
void solve() {
  ll n;
  int q;
  scanf("%lld%d", &n, &q);
  for (int i = 0; i < q; i++) {
    ll x;
    scanf("%lld", &x);
    printf("%lld\n", query(n, x - 1) + 1);
  }
}
int main() {
  solve();
  (void)0;
}
