天呢,这个题2333333,真是被各种卡。完蛋完蛋完蛋。IQ------------;
#include<bits/stdc++.h>
#define lowbit(x) x&(-x)
#define LL long long
#define N 100005
#define M 1000005
#define mod 2147483648LL
#define inf 0x7ffffffff
using namespace std;
inline int ra()
{
int x=,f=; char ch=getchar();
while (ch<'' || ch>''){if (ch=='-') f=-; ch=getchar();}
while (ch>='' && ch<=''){x=x*+ch-''; ch=getchar();}
return x*f;
}
int n,k,last,ans,cnt;
int a[N<<],b[N<<];
int main()
{
n=ra(); k=ra();
for (int i=; i<=n; i++) a[i]=ra();
int last,start=n+;
for (int i=; i<=n; i++)
if (a[i]<) {
start=i;
break;
}
if (start<=n) ans=,k--;
else {
cout<<"";
return ;
}
for (int i=start+; i<=n; i++)
{
if (a[i]<) k--;
if (a[i]>= && a[i-]<) last=i,ans++;
if (a[i]>= && a[i+]<) b[++cnt]=i-last+,ans++;
}
if (k<)
{
cout<<"-1";
return ;
}
sort(b+,b+cnt+);
for (int i=; i<=cnt; i++)
if (k-b[i]<) break;
else k-=b[i],ans-=;
if (a[n]>=)
for (int i=n; i>=; i--)
if (a[i]<)
{
b[++cnt]=n-i;
break;
}
if (b[cnt]<=k && cnt) ans--;
cout<<ans;
return ;
}