#include<bits/stdc++.h>
using namespace std;
const int M = 100000;
int w;
int n;
int a[M];
int main(){
freopen("group.in","r",stdin);
freopen("group.out","w",stdout);
cin>>w>>n;
for(int i = 1; i<=n; i++){
cin>>a[i];
}
sort(a+1, a+n+1);
int ans = 0;
int l = 1, r = n;
while(l<=r){
if(a[l]+a[r] <= w && l!=r){
ans++;
r--;
l++;
}
else{
ans++;
r--;
}
}
cout<<ans;
return 0;
}