#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int w, n;
cin >> w >> n;
vector<int> s(n);
for (int i = 0; i < n; i++)cin >> s[i];
int res = 0;
sort(s.begin(), s.end());
int p1 = 0;
int p2 = n - 1;
while (p1 < p2) {
if (s[p1] + s[p2] > w) {
res++;
p2--;
}
else {
res++;
p1++;
p2--;
}
}if (p1 == p2)res++;
cout << res << endl;
return 0;
}