# include <iostream>
# include <cstdio>
# include <algorithm>
using namespace std;
int n,w,ans=0;
int p[30005];
int main()
{
freopen("group.in", "r", stdin);
freopen("group.out", "w", stdout);
scanf("%d%d", &w, &n);
for (int i=1;i<=n;++i) scanf("%d", &p[i]);
sort(p+1,p+n+1);
int i=1,j=n;
while (i<=j)
{
if (p[i]+p[j]<=w) i++,j--,ans++;
else j--,ans++;
}
if (i==j) ans++;
printf("%d\n", ans);
return 0;
}