#include using namespace std; int main(){ int n,m,a,b; cin >> n >> m; vector C(n),CI(n); for (int& a:C) (cin >> a),++CI[a-1]; while(m--){ cin >> a >> b; if (C[a-1]==C[b-1]) --CI[C[a-1]-1]; } int r(0); for (int a:CI){ cout << r << endl; if (a) r+=a-1; } cout << r << endl; }