#include <bits/stdc++.h>
using namespace std;
int n,m,p,ans=0x3fffffff;
int a[100005],b[100005];
int main()
{
cin>>n>>m>>p;
for (int i=1;i<=p;i++)
{
int x;
cin>>x;
a[x]=1;
}
for (int i=1;i<=n;i++)
{
b[i]=a[i]+b[i-1];
}
for (int i=m;i<=n;i++)
{
if (b[i]-b[i-m]<ans)
{
ans=b[i]-b[i-m];
}
}
cout<<ans<<endl;
}
评论区