#include<bits/stdc++.h> #define fst first #define snd second #define re register
usingnamespace std;
typedef pair<int,int> pii; constint N = 2e5 + 10; int n,k,ans; int d[N],Max[N],p[N]; bool vis[N]; pii arr[N]; vector<int> g[N];
inlineintread(){ int r = 0,w = 1; char c = getchar(); while (c < '0' || c > '9'){ if (c == '-') w = -1; c = getchar(); } while (c >= '0' && c <= '9'){ r = (r << 3) + (r << 1) + (c ^ 48); c = getchar(); } return r * w; }