#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <stack>
#include <cassert>
#include <list>
//#include <unordered_set>
using namespace std;
typedef long long li;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define mp make_pair
#define pb push_back
#define all(s) s.begin(), s.end()
void solve();
int main() {
#ifdef DEBUG
freopen("input", "r", stdin);
//freopen("output", "w", stdout);
clock_t start = clock();
#else
freopen("taxi.in", "r", stdin);
freopen("taxi.out", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
int t = 1;
//cin >> t;
while (t--)
solve();
#ifdef DEBUG
//cout << "\n\n\nTime:" << ((clock() - start) / 1.0 / CLOCKS_PER_SEC);
#endif
return 0;
}
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author RiaD
*/
li a[501010];
void solve() {
li m,d,n;
cin >> m >> d >> n;
for(int i = 0; i < n; ++i)
cin >> a[i];
sort(a, a + n);
if(a[n - 1] >= d + m) {
cout << 1;
return;
}
int badIndex = 0;
long goodPos = d;
for(int i = 0; i <= n; ++i) {
if(i == n) {
cout << 0;
return;
}
if(a[i] >= m - d) {
// System.err.println("bad " + a[i]);
goodPos = (a[i] - (m - d)) / 2;
badIndex = i;
break;
}
}
long last = m - d;
int ans = 1;
for(int i = n - 1; i >= 0; --i) {
if(i == badIndex)
continue;
//System.err.println("see " + a[i]);
if(a[i] < d) {
cout << 0;
return;
}
d -= a[i] - d;
if(d <= -last) {
cout << ans;
return;
}
++ans;
if(d <= goodPos) {
cout << ans;
return;
}
}
cout << 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8cXVldWU+CiNpbmNsdWRlIDxzdGFjaz4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHV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IgcGx1Zy1pbgogKiBBY3R1YWwgc29sdXRpb24gaXMgYXQgdGhlIHRvcAogKiBAYXV0aG9yIFJpYUQKICovCgpsaSBhWzUwMTAxMF07CgogICAgIHZvaWQgc29sdmUoKSB7CgkJbGkgbSxkLG47CgkJY2luID4+IG0gPj4gZCA+PiBuOwogICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyArK2kpCgkJCWNpbiA+PiBhW2ldOwogICAgICAgIAogICAgICAgIHNvcnQoYSwgYSArIG4pOwoKICAgICAgICBpZihhW24gLSAxXSA+PSBkICsgbSkgewogICAgICAgICAgICBjb3V0IDw8IDE7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICB9CgogICAgICAgIGludCBiYWRJbmRleCA9IDA7CiAgICAgICAgbG9uZyBnb29kUG9zID0gZDsKCiAgICAgICAgZm9yKGludCBpID0gMDsgaSA8PSBuOyArK2kpIHsKICAgICAgICAgICAgaWYoaSA9PSBuKSB7CiAgICAgICAgICAgICAgICBjb3V0IDw8IDA7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYoYVtpXSA+PSBtIC0gZCkgewogICAgICAgICAgICAgIC8vICBTeXN0ZW0uZXJyLnByaW50bG4oImJhZCAiICsgYVtpXSk7CiAgICAgICAgICAgICAgICBnb29kUG9zID0gKGFbaV0gLSAobSAtIGQpKSAvIDI7CiAgICAgICAgICAgICAgICBiYWRJbmRleCA9IGk7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQoKICAgICAgICB9CgoKCiAgICAgICAgbG9uZyBsYXN0ID0gbSAtIGQ7CgogICAgICAgIGludCBhbnMgPSAxOwogICAgICAgIGZvcihpbnQgaSA9IG4gLSAxOyBpID49IDA7IC0taSkgewogICAgICAgICAgICBpZihpID09IGJhZEluZGV4KQogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgIC8vU3lzdGVtLmVyci5wcmludGxuKCJzZWUgIiArIGFbaV0pOwogICAgICAgICAgICBpZihhW2ldIDwgZCkgewogICAgICAgICAgICAgICAgY291dCA8PCAwOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGQgLT0gYVtpXSAtIGQ7CgoKICAgICAgICAgICAgaWYoZCA8PSAtbGFzdCkgewogICAgICAgICAgICAgICAgY291dCA8PCBhbnM7CgogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CiAgICAgICAgICAgICsrYW5zOwogICAgICAgICAgICBpZihkIDw9IGdvb2RQb3MpIHsKICAgICAgICAgICAgICAgIGNvdXQgPDwgYW5zOwogICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9CgogICAgICAgIH0KCiAgICAgICAgY291dCA8PCAwOwoKICAgIH0=