#include #include int vis[10000]; int main() { int n, i, x,k; while(scanf("%d",&n)!=EOF) { memset(vis,0,sizeof(vis)); int num = 0,s = 0; for(i=1;i<=n;i++) { scanf("%d",&x); if(vis[x]==0) { vis[x] = 1; s++; } else { num++; } } scanf("%d",&k); if(k<=num) { printf("%d\n",s); } else { printf("%d\n",s-(k-num)); } } return 0; }