#include #define MAX 200055 using namespace std; int vt[MAX], c[MAX]; int m,n, top; int getBit(int x) { int res=0; for (; x>0; x= x & (x-1)) res+=c[x]; return res; } void update(int x) { for (; x<=m+n+10; x+=x&((-1)*x)) { c[x]++; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i=1; i<=n; i++) { vt[i]=n-i+1; } top=n; for (int i=1; i<=m; i++) { int x, u , v; cin >> x; u=getBit(top); v=getBit(vt[x]); cout<