#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int n,m,sum,x;
cin>>n>>m;
set<int> s;
cin>>x;
s.insert(x);
sum=n+1;
m--;
cout<<sum<<"\n";
while(m--)
{
cin>>x;
s.insert(x);
auto pos=s.find(x);
auto pre=pos;
auto nex=pos;
pre--;
nex++;
if(pos!=s.begin()&&pos!=--s.end())
sum+=*(pos)+*(pos);
else if(pos!=s.begin())
sum+=*(pos)+*(pre);
else
sum+=*(pos)+*(nex);
cout<<sum<<"\n";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCWludCBuLG0sc3VtLHg7CgljaW4+Pm4+Pm07CglzZXQ8aW50PiBzOwoJY2luPj54OwoJcy5pbnNlcnQoeCk7CglzdW09bisxOwoJbS0tOwoJY291dDw8c3VtPDwiXG4iOwoJd2hpbGUobS0tKQoJewoJCWNpbj4+eDsKCQlzLmluc2VydCh4KTsKCQlhdXRvIHBvcz1zLmZpbmQoeCk7CgkJYXV0byBwcmU9cG9zOwoJCWF1dG8gbmV4PXBvczsKCQlwcmUtLTsKCQluZXgrKzsKCQlpZihwb3MhPXMuYmVnaW4oKSYmcG9zIT0tLXMuZW5kKCkpCgkJCXN1bSs9Kihwb3MpKyoocG9zKTsKCQllbHNlIGlmKHBvcyE9cy5iZWdpbigpKQoJCQlzdW0rPSoocG9zKSsqKHByZSk7CgkJZWxzZQoJCQlzdW0rPSoocG9zKSsqKG5leCk7CgkJY291dDw8c3VtPDwiXG4iOwoJfQoJcmV0dXJuIDA7Cn0=