#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=30086;
int n,w,ans;
int v[N];
int main()
{
cin>>w>>n;
for(int i=0;i<n;i++) cin>>v[i];
sort(v,v+n);//sort(数组名,数组名+数组长度)
for(int i=0,j=n-1;i<=j;i+=0)
{
if(v[i]+v[j]<=w)
{
ans++;
i++,j--;
}
else
{
ans++,j--;
}
}
cout<<ans<<endl;
return 0;
}