#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
long long int v;
int xx=0;
long long int a[1000001];
int n;
int ans=0;
int main()
{
int i;
freopen("jiahao1.in","r",stdin);
freopen("jiahao1.out","w",stdout);
scanf("%lld%d",&v,&n);
for(i=1;i<=n;i++)
scanf("%lld",&a[i]);
sort(a+1,a+1+n);
for(i=1;i<=n;i++)
{
if(a[i]>=v)break;
if(a[i]%2==1)
{
if(xx==0)
{
v+=((a[i]/2)+1);
xx++;
}
else
{
v+=(a[i]/2);
xx=0;
}
}
else if(a[i]%2==0)v+=(a[i]/2);
ans++;
}
printf("%d",ans);
return 0;
}