#include <bits/stdc++.h>
using namespace std;
typedef long long LL ;
typedef pair<int,int>PII;
const int N = 1e6 + 5;
int a[N];
int main()
{
cin.tie(0),cout.tie(0);
ios::sync_with_stdio(0);
int w,n;
cin >> w >> n;
for(int i = 0;i < n;i++)cin >> a[i];
sort(a,a + n);
int res = 0;
for(int i = 0,j = n - 1;i <= j;)
{
int t = i;
if(a[i] + a[j] <= w)
{
i ++;
j --;
res ++;
}else
{
res ++;
j --;
}
}
if(n % 2 == 1)res ++;
cout << res << endl;
return 0;
}