import sys input = sys.stdin.readline # 文字列入力はするな!! from _collections import defaultdict import sys sys.setrecursionlimit(10**9) k,q=map(int,input().split()) def f(k,n): def g(x): return x-(x-1)//k-1 if n<=k:return n ind=f(k,n-((n-1)//k)-1) mi=0 ma=5*10**18 while ma-mi>1: mid=(ma+mi)//2 if g(mid)>=ind: ma=mid else: mi=mid return ma for _ in range(q): n=int(input()) print(f(k,n))