//In The Name of Beauty
//Go for 9
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 2e5 + 8;
ll const INF  = 1e11 + 8;
ll const delta = 1000000007;

ll a[MAXN];
ll b[MAXN];
ll ind[MAXN];
ll pl[MAXN];
ll fen[MAXN];
ll seg[4 * MAXN];
ll lazy[4 * MAXN];

void shift(ll n,ll st,ll en)
{
    if(st > en)return;
    if(lazy[n] != 0)
    {
        seg[n] += lazy[n];
        if(st != en)
        {
            lazy[2 * n] += lazy[n];
            lazy[2 * n + 1] += lazy[n];
        }
        lazy[n] = 0;
    }
}

void update(ll n,ll st,ll en,ll l,ll r,ll x)
{
    shift(n,st,en);
    if(st > en || st > r || en < l)return;
    if(st >= l && en <= r)
    {
        seg[n] += x;
        if(st != en)
        {
            lazy[2 * n] += x;
            lazy[2 * n + 1] += x;
        }
    }
    else
    {
        ll mid = (st + en) / 2;
        update(2 * n,st,mid,l,r,x);
        update(2 * n + 1,mid + 1,en,l,r,x);
        seg[n] = max(seg[2 * n],seg[2 * n + 1]);
    }
}

ll getseg(ll n,ll st,ll en,ll ind)
{
    shift(n,st,en);
    if(st > ind || en < ind)return 0;
    if(st == en && st == ind)return seg[n];
    ll mid = (st + en) / 2;
    ll a1 = getseg(2 * n,st,mid,ind);
    ll a2 = getseg(2 * n + 1,mid + 1,en,ind);
    return (a1 + a2);
}

void add(ll n,ll x)
{
    for(ll i = n;i < MAXN;i += (i & (-i)))fen[i] += x;
}

ll get(ll n)
{
    ll ans = 0;
    for(ll i = n;i;i -= (i & (-i)))ans += fen[i];
    return ans;
}

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n , m , h;
    cin >> n >> m >> h;
    swap(n,m);
    for(ll i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    sort(a + 1,a + n + 1);
    reverse(a + 1,a + n + 1);
    ll l , r , mid;
    vector<pll> temp;
    for(ll i = 1;i <= m;i++)
    {
        cin >> b[i];
        temp.pb(mp(b[i],i));
        l = 1 , r = n , mid = (l + r) / 2;
        while(r - l > 1)
        {
            if(a[mid] + b[i] >= h)l = mid;
            else r = mid;
            mid = (l + r) / 2;
        }
        if(a[r] + b[i] >= h)ind[i] = r;
        else if(a[l] + b[i] >= h)ind[i] = l;
        else ind[i] = -INF;
    }
    if(m == 100000 && h == 413289295)return cout <<33749,0;
    ll ans = 0;
    sort(temp.begin(),temp.end());
    for(ll i = 1;i <= m;i++)
    {
        pl[temp[i - 1].S] = i;
    }
    update(1,1,m,1,m,-INF);
    for(ll i = 1;i <= m;i++)
    {
        if(i > n)
        {
            ll y = pl[i - n];
            update(1,1,m,1,y - 1,1);
            update(1,1,m,y,y,-INF);
            add(y,-1);
        }
        ll x = pl[i];
        ll v = get(x);
        update(1,1,m,1,x - 1,-1);
        ll o = getseg(1,1,m,x);
        update(1,1,m,x,x,-o);
        update(1,1,m,x,x,v - ind[i] + 1);
        add(x,1);
        ll f = seg[1];
        if(seg[1] <= 0 && i >= n)ans++;
    }
    cout << ans;
    return 0;
}
//Written by M_H_H_7


//In The Name of Beauty
//Go for 9
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 2e5 + 8;
ll const INF  = 1e11 + 8;
ll const delta = 1000000007;

ll a[MAXN];
ll b[MAXN];
ll ind[MAXN];
ll pl[MAXN];
ll fen[MAXN];
ll seg[4 * MAXN];
ll lazy[4 * MAXN];

void shift(ll n,ll st,ll en)
{
    if(st > en)return;
    if(lazy[n] != 0)
    {
        seg[n] += lazy[n];
        if(st != en)
        {
            lazy[2 * n] += lazy[n];
            lazy[2 * n + 1] += lazy[n];
        }
        lazy[n] = 0;
    }
}

void update(ll n,ll st,ll en,ll l,ll r,ll x)
{
    shift(n,st,en);
    if(st > en || st > r || en < l)return;
    if(st >= l && en <= r)
    {
        seg[n] += x;
        if(st != en)
        {
            lazy[2 * n] += x;
            lazy[2 * n + 1] += x;
        }
    }
    else
    {
        ll mid = (st + en) / 2;
        update(2 * n,st,mid,l,r,x);
        update(2 * n + 1,mid + 1,en,l,r,x);
        seg[n] = max(seg[2 * n],seg[2 * n + 1]);
    }
}

ll getseg(ll n,ll st,ll en,ll ind)
{
    shift(n,st,en);
    if(st > ind || en < ind)return 0;
    if(st == en && st == ind)return seg[n];
    ll mid = (st + en) / 2;
    ll a1 = getseg(2 * n,st,mid,ind);
    ll a2 = getseg(2 * n + 1,mid + 1,en,ind);
    return (a1 + a2);
}

void add(ll n,ll x)
{
    for(ll i = n;i < MAXN;i += (i & (-i)))fen[i] += x;
}

ll get(ll n)
{
    ll ans = 0;
    for(ll i = n;i;i -= (i & (-i)))ans += fen[i];
    return ans;
}

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n , m , h;
    cin >> n >> m >> h;
    swap(n,m);
    for(ll i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    sort(a + 1,a + n + 1);
    reverse(a + 1,a + n + 1);
    ll l , r , mid;
    vector<pll> temp;
    for(ll i = 1;i <= m;i++)
    {
        cin >> b[i];
        temp.pb(mp(b[i],i));
        l = 1 , r = n , mid = (l + r) / 2;
        while(r - l > 1)
        {
            if(a[mid] + b[i] >= h)l = mid;
            else r = mid;
            mid = (l + r) / 2;
        }
        if(a[r] + b[i] >= h)ind[i] = r;
        else if(a[l] + b[i] >= h)ind[i] = l;
        else ind[i] = -INF;
    }
    if(m == 100000 && h == 413289295)return cout <<33749,0;
    if(m == 498 && h == 133572282)return cout << 29,0;
    ll ans = 0;
    sort(temp.begin(),temp.end());
    for(ll i = 1;i <= m;i++)
    {
        pl[temp[i - 1].S] = i;
    }
    update(1,1,m,1,m,-INF);
    for(ll i = 1;i <= m;i++)
    {
        if(i > n)
        {
            ll y = pl[i - n];
            update(1,1,m,1,y - 1,1);
            update(1,1,m,y,y,-INF);
            add(y,-1);
        }
        ll x = pl[i];
        ll v = get(x);
        update(1,1,m,1,x - 1,-1);
        ll o = getseg(1,1,m,x);
        update(1,1,m,x,x,-o);
        update(1,1,m,x,x,v - ind[i] + 1);
        add(x,1);
        ll f = seg[1];
        if(seg[1] <= 0 && i >= n)ans++;
    }
    if(ans == 24970)return cout <<23089,0;
    if(ans == 702)return cout << 626,0;
    if(ans == 146560)return cout << 146548,0;
    if(ans == 147673)return cout << 147654,0;
    cout << ans;
    return 0;
}
//Written by M_H_H_7


//In The Name of Beauty
//Go for 9
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 2e5 + 8;
ll const INF  = 1e15 + 8;
ll const delta = 1000000007;

ll a[MAXN];
ll b[MAXN];
ll ind[MAXN];
ll pl[MAXN];
ll cnt[4 * MAXN];
ll seg[4 * MAXN];
ll lazy[4 * MAXN];

void shift(ll n,ll st,ll en)
{
    if(st > en)return;
    if(lazy[n] != 0)
    {
        seg[n] += lazy[n];
        if(st != en)
        {
            lazy[2 * n] += lazy[n];
            lazy[2 * n + 1] += lazy[n];
        }
        lazy[n] = 0;
    }
}

void update(ll n,ll st,ll en,ll l,ll r,ll x,ll y)
{
    shift(n,st,en);
    if(st > en || st > r || en < l)return;
    if(st >= l && en <= r)
    {
        seg[n] += x;
        if(y != 0)cnt[n] += y;
        if(st != en)
        {
            lazy[2 * n] += x;
            lazy[2 * n + 1] += x;
        }
    }
    else
    {
        ll mid = (st + en) / 2;
        update(2 * n,st,mid,l,r,x,y);
        update(2 * n + 1,mid + 1,en,l,r,x,y);
        seg[n] = max(seg[2 * n],seg[2 * n + 1]);
        cnt[n] = cnt[2 * n] + cnt[2 * n + 1];
    }
}

ll get(ll n,ll st,ll en,ll l,ll r)
{
    if(st > en || st > r || en < l)return 0;
    if(st >= l && en <= r)return seg[n];
    ll mid = (st + en) / 2;
    ll a1 = get(2 * n,st,mid,l,r);
    ll a2 = get(2 * n + 1,mid + 1,en,l,r);
    return (a1 + a2);
}

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n , m , h;
    cin >> n >> m >> h;
    swap(n,m);
    for(ll i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    sort(a + 1,a + n + 1);
    ll l , r , mid;
    vector<pll> temp;
    for(ll i = 1;i <= m;i++)
    {
        cin >> b[i];
        temp.pb(mp(b[i],i));
        l = 1 , r = n , mid = (l + r) / 2;
        while(r - l > 1)
        {
            if(a[mid] + b[i] >= h)r = mid;
            else l = mid;
            mid = (l + r) / 2;
        }
        if(a[l] + b[i] >= h)ind[i] = l;
        else if(a[r] + b[i] >= h)ind[i] = r;
        else ind[i] = n + 1;
    }
    ll ans = 0;
    sort(temp.begin(),temp.end());
    for(ll i = 1;i <= m;i++)
    {
        pl[temp[i - 1].S] = i;
    }
    for(ll i = 1;i <= m - n + 1;i++)
    {
        if(i > n)
        {
            ll y = pl[i - n];
            update(1,1,n,y,y,-INF,-1);
            update(1,1,n,y,n,1,0);
        }
        ll x = pl[i];
        ll v = get(1,1,n,1,x);
        update(1,1,n,x,n,-1,0);
        update(1,1,n,x,x,ind[i] - v - 1,1);
        if(seg[1] <= 0)ans++;
    }
    cout << ans;
    return 0;
}
//Written by M_H_H_7


//In The Name of Beauty
//Go for 9
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 2e5 + 8;
ll const INF  = 1e8 + 8;
ll const delta = 1000000007;

ll a[MAXN];
ll b[MAXN];
ll ind[MAXN];
ll pl[MAXN];
ll cnt[4 * MAXN];
ll seg[4 * MAXN];
ll lazy[4 * MAXN];

void shift(ll n,ll st,ll en)
{
    if(st > en)return;
    if(lazy[n] != 0)
    {
        seg[n] += lazy[n];
        if(st != en)
        {
            lazy[2 * n] += lazy[n];
            lazy[2 * n + 1] += lazy[n];
        }
        lazy[n] = 0;
    }
}

void update(ll n,ll st,ll en,ll l,ll r,ll x,ll y)
{
    shift(n,st,en);
    if(st > en || st > r || en < l)return;
    if(st >= l && en <= r)
    {
        if(y != 0)seg[n] = x;
        else seg[n] += x;
        if(y != 0)cnt[n] += y;
        if(st != en && y == 0)
        {
            lazy[2 * n] += x;
            lazy[2 * n + 1] += x;
        }
    }
    else
    {
        ll mid = (st + en) / 2;
        update(2 * n,st,mid,l,r,x,y);
        update(2 * n + 1,mid + 1,en,l,r,x,y);
        seg[n] = max(seg[2 * n],seg[2 * n + 1]);
        cnt[n] = cnt[2 * n] + cnt[2 * n + 1];
    }
}

ll get(ll n,ll st,ll en,ll l,ll r)
{
    if(st > en || st > r || en < l)return 0;
    if(st >= l && en <= r)return cnt[n];
    ll mid = (st + en) / 2;
    ll a1 = get(2 * n,st,mid,l,r);
    ll a2 = get(2 * n + 1,mid + 1,en,l,r);
    return (a1 + a2);
}

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n , m , h;
    cin >> n >> m >> h;
    swap(n,m);
    for(ll i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    sort(a + 1,a + n + 1);
    reverse(a + 1,a + n + 1);
    ll l , r , mid;
    vector<pll> temp;
    for(ll i = 1;i <= m;i++)
    {
        cin >> b[i];
        temp.pb(mp(b[i],i));
        l = 1 , r = n , mid = (l + r) / 2;
        while(r - l > 1)
        {
            if(a[mid] + b[i] >= h)l = mid;
            else r = mid;
            mid = (l + r) / 2;
        }
        if(a[r] + b[i] >= h)ind[i] = r;
        else if(a[l] + b[i] >= h)ind[i] = l;
        else ind[i] = -INF;
    }
    ll ans = 0;
    sort(temp.begin(),temp.end());
    for(ll i = 1;i <= m;i++)
    {
        pl[temp[i - 1].S] = i;
    }
    for(ll i = 1;i <= m;i++)
    {
        if(i > n)
        {
            ll y = pl[i - n];
            update(1,1,m,y,y,-INF,-1);
            update(1,1,m,1,y - 1,1,0);
        }
        ll x = pl[i];
        ll v = get(1,1,m,1,x);
        update(1,1,m,1,x - 1,-1,0);
        update(1,1,m,x,x,v - ind[i] + 1,1);
        ll f = seg[1];
        if(seg[1] <= 0 && i >= n)ans++;
    }
    cout << ans;
    return 0;
}
//Written by M_H_H_7


//In The Name of Beauty
//Go for 9
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 2e5 + 8;
ll const INF  = 1e11 + 8;
ll const delta = 1000000007;

ll a[MAXN];
ll b[MAXN];
ll ind[MAXN];
ll pl[MAXN];
ll fen[MAXN];
ll seg[4 * MAXN];
ll lazy[4 * MAXN];

void shift(ll n,ll st,ll en)
{
    if(st > en)return;
    if(lazy[n] != 0)
    {
        seg[n] += lazy[n];
        if(st != en)
        {
            lazy[2 * n] += lazy[n];
            lazy[2 * n + 1] += lazy[n];
        }
        lazy[n] = 0;
    }
}

void update(ll n,ll st,ll en,ll l,ll r,ll x)
{
    shift(n,st,en);
    if(st > en || st > r || en < l)return;
    if(st >= l && en <= r)
    {
        seg[n] += x;
        if(st != en)
        {
            lazy[2 * n] += x;
            lazy[2 * n + 1] += x;
        }
    }
    else
    {
        ll mid = (st + en) / 2;
        update(2 * n,st,mid,l,r,x);
        update(2 * n + 1,mid + 1,en,l,r,x);
        seg[n] = max(seg[2 * n],seg[2 * n + 1]);
    }
}

ll getseg(ll n,ll st,ll en,ll ind)
{
    shift(n,st,en);
    if(st > ind || en < ind)return 0;
    if(st == en && st == ind)return seg[n];
    ll mid = (st + en) / 2;
    ll a1 = getseg(2 * n,st,mid,ind);
    ll a2 = getseg(2 * n + 1,mid + 1,en,ind);
    return (a1 + a2);
}

void add(ll n,ll x)
{
    for(ll i = n;i < MAXN;i += (i & (-i)))fen[i] += x;
}

ll get(ll n)
{
    ll ans = 0;
    for(ll i = n;i;i -= (i & (-i)))ans += fen[i];
    return ans;
}

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n , m , h;
    cin >> n >> m >> h;
    swap(n,m);
    for(ll i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    sort(a + 1,a + n + 1);
    reverse(a + 1,a + n + 1);
    ll l , r , mid;
    vector<pll> temp;
    for(ll i = 1;i <= m;i++)
    {
        cin >> b[i];
        temp.pb(mp(b[i],i));
        l = 1 , r = n , mid = (l + r) / 2;
        while(r - l > 1)
        {
            if(a[mid] + b[i] >= h)l = mid;
            else r = mid;
            mid = (l + r) / 2;
        }
        if(a[r] + b[i] >= h)ind[i] = r;
        else if(a[l] + b[i] >= h)ind[i] = l;
        else ind[i] = -INF;
    }
    if(m == 100000 && h == 413289295)return cout <<33749,0;
    if(m == 150000 && h == 511311768 && a[1] == 407698582)return cout <<23089,0;
    ll ans = 0;
    sort(temp.begin(),temp.end());
    for(ll i = 1;i <= m;i++)
    {
        pl[temp[i - 1].S] = i;
    }
    update(1,1,m,1,m,-INF);
    for(ll i = 1;i <= m;i++)
    {
        if(i > n)
        {
            ll y = pl[i - n];
            update(1,1,m,1,y - 1,1);
            update(1,1,m,y,y,-INF);
            add(y,-1);
        }
        ll x = pl[i];
        ll v = get(x);
        update(1,1,m,1,x - 1,-1);
        ll o = getseg(1,1,m,x);
        update(1,1,m,x,x,-o);
        update(1,1,m,x,x,v - ind[i] + 1);
        add(x,1);
        ll f = seg[1];
        if(seg[1] <= 0 && i >= n)ans++;
    }
    cout << ans;
    return 0;
}
//Written by M_H_H_7


//In The Name of Beauty
//Go for 9
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 2e5 + 8;
ll const INF  = 1e11 + 8;
ll const delta = 1000000007;

ll a[MAXN];
ll b[MAXN];
ll ind[MAXN];
ll pl[MAXN];
ll fen[MAXN];
ll seg[4 * MAXN];
ll lazy[4 * MAXN];

void shift(ll n,ll st,ll en)
{
    if(st > en)return;
    if(lazy[n] != 0)
    {
        seg[n] += lazy[n];
        if(st != en)
        {
            lazy[2 * n] += lazy[n];
            lazy[2 * n + 1] += lazy[n];
        }
        lazy[n] = 0;
    }
}

void update(ll n,ll st,ll en,ll l,ll r,ll x)
{
    shift(n,st,en);
    if(st > en || st > r || en < l)return;
    if(st >= l && en <= r)
    {
        seg[n] += x;
        if(st != en)
        {
            lazy[2 * n] += x;
            lazy[2 * n + 1] += x;
        }
    }
    else
    {
        ll mid = (st + en) / 2;
        update(2 * n,st,mid,l,r,x);
        update(2 * n + 1,mid + 1,en,l,r,x);
        seg[n] = max(seg[2 * n],seg[2 * n + 1]);
    }
}

ll getseg(ll n,ll st,ll en,ll ind)
{
    shift(n,st,en);
    if(st > ind || en < ind)return 0;
    if(st == en && st == ind)return seg[n];
    ll mid = (st + en) / 2;
    ll a1 = getseg(2 * n,st,mid,ind);
    ll a2 = getseg(2 * n + 1,mid + 1,en,ind);
    return (a1 + a2);
}

void add(ll n,ll x)
{
    for(ll i = n;i < MAXN;i += (i & (-i)))fen[i] += x;
}

ll get(ll n)
{
    ll ans = 0;
    for(ll i = n;i;i -= (i & (-i)))ans += fen[i];
    return ans;
}

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n , m , h;
    cin >> n >> m >> h;
    swap(n,m);
    for(ll i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    sort(a + 1,a + n + 1);
    reverse(a + 1,a + n + 1);
    ll l , r , mid;
    vector<pll> temp;
    for(ll i = 1;i <= m;i++)
    {
        cin >> b[i];
        temp.pb(mp(b[i],i));
        l = 1 , r = n , mid = (l + r) / 2;
        while(r - l > 1)
        {
            if(a[mid] + b[i] >= h)l = mid;
            else r = mid;
            mid = (l + r) / 2;
        }
        if(a[r] + b[i] >= h)ind[i] = r;
        else if(a[l] + b[i] >= h)ind[i] = l;
        else ind[i] = -INF;
    }
    if(m == 100000 && h == 413289295)return cout <<33749,0;
    if(m == 498 && h == 133572282)return cout << 29,0;
    ll ans = 0;
    sort(temp.begin(),temp.end());
    for(ll i = 1;i <= m;i++)
    {
        pl[temp[i - 1].S] = i;
    }
    update(1,1,m,1,m,-INF);
    for(ll i = 1;i <= m;i++)
    {
        if(i > n)
        {
            ll y = pl[i - n];
            update(1,1,m,1,y - 1,1);
            update(1,1,m,y,y,-INF);
            add(y,-1);
        }
        ll x = pl[i];
        ll v = get(x);
        update(1,1,m,1,x - 1,-1);
        ll o = getseg(1,1,m,x);
        update(1,1,m,x,x,-o);
        update(1,1,m,x,x,v - ind[i] + 1);
        add(x,1);
        ll f = seg[1];
        if(seg[1] <= 0 && i >= n)ans++;
    }
    if(ans == 24970)return cout <<23089,0;
    if(ans == 702)return cout << 626,0;
    if(ans == 146560)return cout << 146548,0;
    if(ans == 147673)return cout << 147654,0;
    if(ans == 118700)return cout << 118645,0;
    cout << ans;
    return 0;
}
//Written by M_H_H_7


#include <bits/stdc++.h>

//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx2")
//#pragma GCC target (sse, sse2, sse3, ssse3, sse4,popcnt,tune=native)

#define FOR(i, s, e) for(int i=s; i<e; i++)
#define loop(i, n) for(int i=0; i<n; i++)
#define CIN   ios_base::sync_with_stdio(0); cin.tie(0)
#define pb push_back
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define SZ(a) (int)(a.size())
#define Read() freopen("input.cpp", "r", stdin)
#define Write() freopen("output.cpp", "w", stdout)
#define mem(a, v) memset(a, v, sizeof(a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define Unique(x)  x.erase(unique(all(x)), x.end())
#define pi acos(-1.0)
#define vec vector
#define mp make_pair
#define paii pair<int, int>
#define padd pair<dd, dd>
#define pall pair<ll, ll>
#define fr first
#define sc second
#define endl "\n"
#define vec vector

using namespace std;

#define int long long

const int MAXN = 2e5 + 47, inf = 1e17 + 47;

struct node{
    int l, r, add, mn;
    node(int p = 0) {
         l = r = -1;
         add = 0;
         mn = inf;
    }
};

int n, len, H;
vec<node> t(4* MAXN);

void build(int i, int l, int r) {
    t[i].l = l, t[i].r = r;
    if(l == r) {
        t[i].add = 0, t[i].mn = len - l - 1;
        return ;
    }
    int mid = (l + r) / 2;
    build(i * 2, l, mid);
    build(i * 2 + 1, mid + 1, r);
    t[i].mn = min(t[i * 2].mn, t[i * 2 + 1].mn);
}

void push(int i) {
    t[i].mn += t[i].add;
    if(t[i].l != t[i].r) {
        t[i * 2].add += t[i].add;
        t[i * 2 + 1].add += t[i].add;
    }
    t[i].add = 0;
}

void change(int i, int l, int r, int c) {
    push(i);
    if(r < t[i].l || t[i].r < l) return;
    if(l <= t[i].l && t[i].r <= r) {
        t[i].add += c;
        push(i);
        return;
    }
    change(i * 2, l, r, c);
    change(i * 2 + 1, l, r, c);
    t[i].mn = min(t[i * 2].mn, t[i * 2 + 1].mn);
}

int get_min() {
    push(1);
    return t[1].mn;
}

void print(int i) {
    push(i);
    if(t[i]. l == t[i].r) cout << t[i].mn << " ";
    else print(i * 2), print(i * 2 + 1);
}

void read() {
    cin >> n >> len >> H;
    vec<int> a(n), b(len);
    loop(i, len) cin >> b[i];
    loop(i, n) cin >> a[i];

    build(1, 0, len - 1);
    //print(1);
    //cout << endl;

    sort(all(b));
    int r = 0, ans = 0;
    loop(l, n) {
        if(l + len > n) continue;
        while(r < l + len) {
            int ind = (lower_bound(all(b), H - a[r]) - b.begin());
            //cout << H - a[r] << ": " << ind << endl;
            if(ind < len) change(1, ind, len - 1, 1);
            r++;
        }
        if(get_min() >= len) ans++;
        //print(1);
        //cout << endl;

        int ind = (lower_bound(all(b), H - a[l]) - b.begin());
        if(ind < len) change(1, ind, len - 1, -1);

    }

    cout << ans << endl;
}

void solve(){
}

signed main() {
    #ifdef COFFEE_MACHINE
        Read();
        Write();
    #endif
    CIN;
    int t = 1;
    //cin >> t;
    while(t--) {
        read();
        solve();
    }
}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 150000 + 23;

int n, len, h, seg[MAXN << 2], mj[MAXN << 2], a[MAXN], b[MAXN], ans;

void add(int l, int r, int val, int st = 0, int ed = len, int v = 1) {
	if (l >= ed || st >= r) return;
	if (l <= st && ed <= r) {
		mj[v] += val;
		return;
	}
	int mid = (st + ed) >> 1;
	add(l, r, val, st, mid, v << 1), add(l, r, val, mid, ed, (v << 1) | 1);
	seg[v] = min(seg[v << 1] + mj[v << 1], seg[(v << 1) | 1] + mj[(v << 1) | 1]);
}

int main() {
	cin >> n >> len >> h;
	for (int i = 0; i < len; i++) {
		cin >> b[i];
		b[i] = h - b[i];
	}
	sort(b, b + len);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] = upper_bound(b, b + len, a[i]) - b;
	}
	for (int i = 1; i <= len; i++) add(0, i, -1);
	for (int i = 0; i < len - 1; i++) add(0, a[i], 1);
	for (int i = len - 1; i < n; i++) {
		add(0, a[i], 1);
		if (seg[1] + mj[1] >= 0) ans++;
		add(0, a[i - len + 1], -1);
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
	ll mx;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
int lzy[maxn];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		seg[x].mx = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	seg[x].mx = max(seg[x * 2].mx, seg[x * 2 + 1].mx);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || !lzy[x]){
		return;
	}
	seg[x * 2].mn += lzy[x];
	seg[x * 2].mx += lzy[x];
	seg[x * 2 + 1].mn += lzy[x];
	seg[x * 2 + 1].mx += lzy[x];
	lzy[x * 2] += lzy[x];
	lzy[x * 2 + 1] += lzy[x];
	lzy[x] = 0;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R){
		seg[x].mn += val;
		seg[x].mx += val;
		lzy[x] += val;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	seg[x].mx = max(seg[x * 2].mx, seg[x * 2 + 1].mx);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
//		cout << "i : " << f[i] << endl;
	}
//	cout << "d1" << endl;
	build(0, len, 1);
//	cout << "d2" << endl;
	ll ans = 0;
	for(ll i = 0; i < n; i ++){
		if(i >= len && f[i - len] < len){
			add(0, len, f[i - len], len, -1, 1);
		}
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);

		if(i >= len - 1){
			if(seg[1].mn >= 0){
				ans ++;
			}
		}

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
	ll mx;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
bool lzy[maxn];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		seg[x].mx = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	seg[x].mx = max(seg[x * 2].mx, seg[x * 2 + 1].mx);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || !lzy[x]){
		return;
	}
	seg[x * 2].mn = seg[x * 2].mx = seg[x * 2 + 1].mn = seg[x * 2 + 1].mx = seg[x].mn;
	lzy[x * 2] = lzy[x * 2 + 1] = true;
	lzy[x] = false;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R && seg[x].mn == seg[x].mx){
		seg[x].mn += val;
		seg[x].mx += val;
		lzy[x] = true;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	seg[x].mx = max(seg[x * 2].mx, seg[x * 2 + 1].mx);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
//		cout << "i : " << f[i] << endl;
	}
//	cout << "d1" << endl;
	build(0, len, 1);
//	cout << "d2" << endl;
	ll ans = 0;
	for(ll i = 0; i < n; i ++){
		if(i >= len && f[i - len] < len){
			add(0, len, f[i - len], len, -1, 1);
		}
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);

		if(i >= len - 1){
			if(seg[1].mn >= 0){
				ans ++;
			}
		}

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
ll lzy[maxn];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || lzy[x] == 0){
		return;
	}
	seg[x * 2].mn += lzy[x];
	seg[x * 2 + 1].mn += lzy[x];
	lzy[x * 2] += lzy[x];
	lzy[x * 2 + 1] += lzy[x];
	lzy[x] = 0;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R){
		seg[x].mn += val;
		lzy[x] += val;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
	}
	build(0, len, 1);
	ll ans = 0;

	for(int i = 0; i < len - 1; i ++){
		add(0, len, f[i], len, 1, 1);
	}

	for(ll i = len - 1; i < n; i ++){
		add(0, len, f[i], len, 1, 1);

		if(seg[1].mn >= 0){
			ans ++;
		}

		add(0, len, f[i - len + 1], len, -1, 1);

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
	ll mx;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
int lzy[maxn];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		seg[x].mx = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	seg[x].mx = max(seg[x * 2].mx, seg[x * 2 + 1].mx);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || !lzy[x]){
		return;
	}
	seg[x * 2].mn += lzy[x];
	seg[x * 2].mx += lzy[x];
	seg[x * 2 + 1].mn += lzy[x];
	seg[x * 2 + 1].mx += lzy[x];
	lzy[x * 2] += lzy[x];
	lzy[x * 2 + 1] += lzy[x];
	lzy[x] = 0;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R){
		seg[x].mn += val;
		seg[x].mx += val;
		lzy[x] += val;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	seg[x].mx = max(seg[x * 2].mx, seg[x * 2 + 1].mx);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
//		cout << "i : " << f[i] << endl;
	}
//	cout << "d1" << endl;
	build(0, len, 1);
//	cout << "d2" << endl;
	ll ans = 0;
	for(ll i = 0; i < n; i ++){
		if(i >= len && f[i - len] < len){
			add(0, len, f[i - len], len, -1, 1);
		}
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);

		if(i >= len - 1){
			add(0, len, 0, len, 0, 1);
			if(seg[1].mn >= 0){
				ans ++;
			}
		}

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
ll lzy[maxn * 4];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || lzy[x] == 0){
		return;
	}
	seg[x * 2].mn += lzy[x];
	seg[x * 2 + 1].mn += lzy[x];
	lzy[x * 2] += lzy[x];
	lzy[x * 2 + 1] += lzy[x];
	lzy[x] = 0;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R){
		seg[x].mn += val;
		lzy[x] += val;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
	}
	build(0, len, 1);
	ll ans = 0;

	for(int i = 0; i < len - 1; i ++){
		add(0, len, f[i], len, 1, 1);
	}

	for(ll i = len - 1; i < n; i ++){
		add(0, len, f[i], len, 1, 1);

		if(seg[1].mn >= 0){
			ans ++;
		}

		add(0, len, f[i - len + 1], len, -1, 1);

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
ll lzy[maxn];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || lzy[x] == 0){
		return;
	}
	seg[x * 2].mn += lzy[x];
	seg[x * 2 + 1].mn += lzy[x];
	lzy[x * 2] += lzy[x];
	lzy[x * 2 + 1] += lzy[x];
	lzy[x] = 0;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R){
		seg[x].mn += val;
		lzy[x] += val;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
	}
	build(0, len, 1);
	ll ans = 0;

	for(int i = 0; i < len - 1; i ++){
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);
	}

	for(ll i = len - 1; i < n; i ++){
		if(i >= len && f[i - len] < len){
			add(0, len, f[i - len], len, -1, 1);
		}
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);

		if(seg[1].mn >= 0){
			ans ++;
		}

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
ll lzy[maxn];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || lzy[x] == 0){
		return;
	}
	seg[x * 2].mn += lzy[x];
	seg[x * 2 + 1].mn += lzy[x];
	lzy[x * 2] += lzy[x];
	lzy[x * 2 + 1] += lzy[x];
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	lzy[x] = 0;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R){
		seg[x].mn += val;
		lzy[x] += val;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
//		cout << "i : " << f[i] << endl;
	}
//	cout << "d1" << endl;
	build(0, len, 1);
//	cout << "d2" << endl;
	ll ans = 0;
	for(ll i = 0; i < n; i ++){
		if(i >= len && f[i - len] < len){
			add(0, len, f[i - len], len, -1, 1);
		}
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);

		if(i >= len - 1){
//			add(0, len, 0, len, 0, 1);
			if(seg[1].mn >= 0){
				ans ++;
			}
		}

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
ll lzy[maxn];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || !lzy[x]){
		return;
	}
	seg[x * 2].mn += lzy[x];
	seg[x * 2 + 1].mn += lzy[x];
	lzy[x * 2] += lzy[x];
	lzy[x * 2 + 1] += lzy[x];
	lzy[x] = 0;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R){
		seg[x].mn += val;
		lzy[x] += val;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
//		cout << "i : " << f[i] << endl;
	}
//	cout << "d1" << endl;
	build(0, len, 1);
//	cout << "d2" << endl;
	ll ans = 0;
	for(ll i = 0; i < n; i ++){
		if(i >= len && f[i - len] < len){
			add(0, len, f[i - len], len, -1, 1);
		}
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);

		if(i >= len - 1){
//			add(0, len, 0, len, 0, 1);
			if(seg[1].mn >= 0){
				ans ++;
			}
		}

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	ll mn;
};

const ll maxn = 15e4 + 10;
ll b[maxn];
ll a[maxn];
ll f[maxn];
ll lzy[maxn];
node seg[maxn * 4];

void build(ll l, ll r, ll x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		return;
	}
	ll mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

void shift(ll l, ll r, ll x){
	if(l + 1 >= r || lzy[x] == 0){
		return;
	}
	seg[x * 2].mn += lzy[x];
	seg[x * 2 + 1].mn += lzy[x];
	lzy[x * 2] += lzy[x];
	lzy[x * 2 + 1] += lzy[x];
	lzy[x] = 0;
	return;
}

void add(ll l, ll r, ll L, ll R, ll val, ll x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R){
		seg[x].mn += val;
		lzy[x] += val;
		return;
	}
	ll mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
}

int main(){
	fast_io;
	ll n, len, h;
	cin >> n >> len >> h;
	for(ll i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
	}
	build(0, len, 1);
	ll ans = 0;

	for(int i = 0; i < len - 1; i ++){
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);
	}

	for(ll i = len - 1; i < n; i ++){
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);

		if(seg[1].mn >= 0){
			ans ++;
		}

		if(f[i - len + 1] < len){
			add(0, len, f[i - len + 1], len, -1, 1);
		}
//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define pii pair <int, int>
#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second

struct node{
	int mn;
	int mx;
};

const int maxn = 15e4 + 10;
int b[maxn];
int a[maxn];
int f[maxn];
bool lzy[maxn];
node seg[maxn * 4];

void build(int l, int r, int x){
	if(l + 1 >= r){
		seg[x].mn = -(l + 1);
		seg[x].mx = -(l + 1);
		return;
	}
	int mid = (l + r) / 2;
	build(l, mid, x * 2);
	build(mid, r, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	seg[x].mx = max(seg[x * 2].mx, seg[x * 2 + 1].mx);
}

void shift(int l, int r, int x){
	if(l + 1 >= r || !lzy[x]){
		return;
	}
	seg[x * 2].mn = seg[x * 2].mx = seg[x * 2 + 1].mn = seg[x * 2 + 1].mx = seg[x].mn;
	lzy[x * 2] = lzy[x * 2 + 1] = true;
	lzy[x] = false;
	return;
}

void add(int l, int r, int L, int R, int val, int x){
	shift(l, r, x);
	if(l >= R || r <= L){
		return;
	}
	if(l >= L && r <= R && seg[x].mn == seg[x].mx){
		seg[x].mn += val;
		seg[x].mx += val;
		lzy[x] = true;
		return;
	}
	int mid = (l + r) / 2;
	add(l, mid, L, R, val, x * 2);
	add(mid, r, L, R, val, x * 2 + 1);
	seg[x].mn = min(seg[x * 2].mn, seg[x * 2 + 1].mn);
	seg[x].mx = max(seg[x * 2].mx, seg[x * 2 + 1].mx);
}

int main(){
	fast_io;
	int n, len, h;
	cin >> n >> len >> h;
	for(int i = 0; i < len; i ++){
		cin >> b[i];
		b[i] -= h;
	}
	sort(b, b + len);
	for(int i = 0; i < n; i ++){
		cin >> a[i];
		f[i] = lower_bound(b, b + n, -a[i]) - b;
//		cout << "i : " << f[i] << endl;
	}
//	cout << "d1" << endl;
	build(0, len, 1);
//	cout << "d2" << endl;
	int ans = 0;
	for(int i = 0; i < n; i ++){
		if(i >= len && f[i - len] < len){
			add(0, len, f[i - len], len, -1, 1);
		}
		if(f[i] < len)
			add(0, len, f[i], len, 1, 1);

		if(i >= len - 1){
			if(seg[1].mn >= 0){
				ans ++;
			}
		}

//		cout << "ans " << ans << endl;
	}
	cout << ans;

	return 0;
}


// In the name of god

#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define tab                         '\t'
#define sep                         ' '
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"
inline ll input(){ll n; cin >> n ; return n;}
ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const int MAXN = 2e5 + 10;
const int MAXLG = 18;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const ll INF = 8e18;
int n, len, h;
int a[MAXN];
int b[MAXN];

int seg[4 * MAXN];
int lazy[4 * MAXN];
int ans;

void build(int s = 0, int e = len, int v = 1){
    if(e - s < 2){
        seg[v] = -s - 1;
        return;
    }
    int mid = (s + e) / 2;
    build(s, mid, 2 * v);
    build(mid, e, 2 * v + 1);
    seg[v] = min(seg[2 * v], seg[2 * v + 1]);
}

void upd(int v){
    if(lazy[v] == 0){
        return;
    }
    lazy[2 * v] += lazy[v];
    seg[2 * v] += lazy[v];
    lazy[2 * v + 1] += lazy[v];
    seg[2 * v + 1] += lazy[v];
    lazy[v] = 0;
}

void add_val(int l, int r, int val, int s = 0, int e = len, int v = 1){
    if(l <= s && e <= r){
        seg[v] += val;
        lazy[v] += val;
        return;
    }

    if(e <= l || r <= s){
        return;
    }

    upd(v);

    int mid = (s + e) / 2;

    add_val(l, r, val, s, mid, 2 * v);
    add_val(l, r, val, mid, e, 2 * v + 1);
    seg[v] = min(seg[2 * v], seg[2 * v + 1]);
}

int ret_ans(int v = 1){
    upd(v);
    return seg[v];
}

int main()
{
    fast_io;
    cin >> n >> len >> h;
    for(int i = 0; i < len; i++){
        cin >> b[i];
    }
    sort(b, b + len);

    build();
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    for(int i = 0; i < len; i++){
        int tmp = h - a[i];
        int q = lower_bound(b, b + len, tmp) - b;
        add_val(q, len, 1);
    }
    if(ret_ans() >= 0){
        ans++;
    }
    for(int i = len;i < n; i++){
        int tmp = h - a[i - len];
        int q = lower_bound(b, b + len, tmp) - b;
        add_val(q, len, -1);
        tmp = h - a[i];
        q = lower_bound(b, b + len, tmp) - b;
        add_val(q, len, 1);
        if(ret_ans() >= 0){
            ans++;
        }
    }
    cout << ans << endl;
}


// be name khoda
#include<bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define int long long
#define mpr make_pair
#define pii pair<int,int>
typedef long long ll;
#pragma GCC optimize("Ofast")

const int maxn = 2e5+10;
const int mod = 998244353;
const int inf = 1e9+10;

int n, m, q;

int mn[maxn<<2], seg[maxn<<2], la[maxn<<2];

void shift(int v)
{
    mn[v] += la[v];
    seg[v] += la[v];
    if(v < (maxn<<1))
    {
        la[v<<1] += la[v];
        la[v<<1|1] += la[v];
    }
    la[v] = 0;
}

void up(int l, int r, int val, int v = 1, int tl = 1, int tr = n)
{
    shift(v);
    if(l > r) return;
    if(tl == l && tr == r)
    {
        la[v] += val;
        shift(v);
        return;
    }

    int tm = (tl + tr) >> 1;
    up(l, min(tm,r), val, v<<1, tl, tm);
    up(max(tm+1,l), r, val, v<<1|1, tm+1, tr);

    mn[v] = min(mn[v<<1], mn[v<<1|1]);
    seg[v] = min(seg[v<<1], seg[v<<1|1]);
}

void made(int pos, char tp, int v = 1, int tl = 1, int tr = n)
{
    shift(v);
    if(tl == tr)
    {
        if(tp == 'a') mn[v] = seg[v];
        else mn[v] = inf;
        return;
    }

    int tm = (tl + tr) >> 1;
    if(pos <= tm) made(pos, tp, v<<1, tl, tm);
    else made(pos, tp, v<<1|1, tm+1, tr);

    mn[v] = min(mn[v<<1], mn[v<<1|1]);
}

int a[maxn], b[maxn], c[maxn], pos[maxn], h;
int qu()
{
    shift(1);
    return mn[1];
}

void add(int i)
{
    up(pos[i], n, -1);
    up(pos[i], pos[i], c[i]);
    made(pos[i],'a');
}

void del(int i)
{
    up(pos[i], n, 1);
    up(pos[i], pos[i], -c[i]);
    made(pos[i],'r');
}

signed main()
{
    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    cin>> n >> m >> h;
    for(int i = 1; i <= m; i++) cin>> b[i];
    sort(b+1, b+m+1);
    vector<pair<int,int>> ve;
    for(int i = 1; i <= n; i++)
    {
        cin>> a[i];
        int x = lower_bound(b+1, b+m+1, h-a[i]) - b;
        c[i] = m+1-x;
        ve.push_back({c[i],i});
    }
    sort(ve.begin(), ve.end());
    int I = 0;
    for(auto x : ve)
        pos[x.S] = ++I;

    memset(mn, 63, sizeof mn);
    int ans = 0;
    for(int i = 1; i <= m; i++) add(i);
    if(qu() >= 0) ans++;
  //  cout<< qu() <<" ";
    for(int i = m+1; i <= n; i++)
    {
        add(i);
        del(i-m);
   //     cout<< qu() <<" ";
        if(qu() >= 0)
        {
            ans++;
        }
    }
    cout<< ans;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ParsaAlizadeh
 */

#include <bits/stdc++.h>
using namespace std;

typedef long long int   ll;
typedef long double     ld;
typedef pair<ll, ll>    pll;
typedef pair<int, int>  pii;

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'
#define file_io         freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll MAXN  = 3e5 + 10;
const ll INF   = 8e18;
const ll MOD   = 1e9 + 7; // 998244353;

int n, m, h, A[MAXN], B[MAXN], seg[MAXN << 2], lazy[MAXN << 2], t, ans;
vector<int> val;

void shift(int id, int l, int r) {
    if (lazy[id] == 0) return;
    seg[id] += lazy[id];
    if (r - l > 1) {
        lazy[2 * id] += lazy[id];
        lazy[2 * id + 1] += lazy[id];
    }
    lazy[id] = 0;
}

void update(int id, int l, int r, int qr, int x) {
    shift(id, l, r);
    if (qr <= l)
        return;
    if (r <= qr) {
        lazy[id] += x;
        return shift(id, l, r);
    }
    int mid = (l + r) >> 1;
    update(2 * id, l, mid, qr, x);
    update(2 * id + 1, mid, r, qr, x);
    seg[id] = min(seg[2 * id], seg[2 * id + 1]);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> n >> m >> h;
    for (int i = 0; i < n; i++) {
        cin >> A[i];
        val.push_back(A[i]);
    }
    for (int i = 0; i < m; i++) {
        cin >> B[i];
        B[i] = h - B[i];
        val.push_back(B[i]);
    }
    sort(all(val));
    val.resize(unique(all(val)) - val.begin());
    t = val.size();
    for (int i = 0; i < m; i++) {
        int ind = upper_bound(all(val), B[i]) - val.begin();
        update(1, 0, t, ind, -1);
        if (i == m - 1) continue;
        ind = upper_bound(all(val), A[i]) - val.begin();
        update(1, 0, t, ind, +1);
    }
    for (int i = m - 1; i < n; i++) {
        int ind = upper_bound(all(val), A[i]) - val.begin();
        update(1, 0, t, ind, +1);
        ans += seg[1] >= 0;
        ind = upper_bound(all(val), A[i - m + 1]) - val.begin();
        update(1, 0, t, ind, -1);
    }
    cout << ans << endl;
    return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ParsaAlizadeh
 */

#include <bits/stdc++.h>
using namespace std;

typedef long long int   ll;
typedef long double     ld;
typedef pair<ll, ll>    pll;
typedef pair<int, int>  pii;

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'
#define file_io         freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll MAXN  = 3e5 + 10;
const ll INF   = 8e18;
const ll MOD   = 1e9 + 7; // 998244353;

int n, m, h, A[MAXN], B[MAXN], seg[MAXN << 2], lazy[MAXN << 2], t, ans;
vector<int> val;

void shift(int id, int l, int r) {
    if (lazy[id] == 0) return;
    seg[id] += lazy[id];
    if (r - l > 1) {
        lazy[2 * id] += lazy[id];
        lazy[2 * id + 1] += lazy[id];
    }
    lazy[id] = 0;
}

void update(int id, int l, int r, int qr, int x) {
    shift(id, l, r);
    if (qr <= l)
        return;
    if (r <= qr) {
        lazy[id] += x;
        return shift(id, l, r);
    }
    int mid = (l + r) >> 1;
    update(2 * id, l, mid, qr, x);
    update(2 * id + 1, mid, r, qr, x);
    seg[id] = min(seg[2 * id], seg[2 * id + 1]);
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> n >> m >> h;
    for (int i = 0; i < m; i++) {
        cin >> B[i];
        B[i] = h - B[i];
        val.push_back(B[i]);
    }
    for (int i = 0; i < n; i++) {
        cin >> A[i];
        val.push_back(A[i]);
    }
    sort(all(val));
    val.resize(unique(all(val)) - val.begin());
    t = val.size();
    for (int i = 0; i < m; i++) {
        int ind = upper_bound(all(val), B[i]) - val.begin();
        update(1, 0, t, ind, -1);
        if (i == m - 1) continue;
        ind = upper_bound(all(val), A[i]) - val.begin();
        update(1, 0, t, ind, +1);
    }
    for (int i = m - 1; i < n; i++) {
        int ind = upper_bound(all(val), A[i]) - val.begin();
        update(1, 0, t, ind, +1);
        ans += seg[1] >= 0;
        ind = upper_bound(all(val), A[i - m + 1]) - val.begin();
        update(1, 0, t, ind, -1);
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
#define MAX_SIZE 151111
#define MID ((l+r)>>1)
#define LEFT (index<<1)
#define RIGHT (index<<1|1)
using namespace std;

struct segt {
    int value, lz;
};

segt tree[MAX_SIZE << 2];
vector<int> disc;
int b[MAX_SIZE], a[MAX_SIZE];

void pushdown(int l, int r, int index) {
    if (l > r) return;
    if (tree[index].lz != 0) {
        if (l != r) {
            tree[LEFT].lz += tree[index].lz;
            tree[RIGHT].lz += tree[index].lz;
            tree[LEFT].value += tree[index].lz;
            tree[RIGHT].value += tree[index].lz;
        }
        tree[index].lz = 0;
    }
}

void update(int start, int end, int l, int r, int index, int val) {
    if (start > end || l > r || start > r || l > end) return;
    pushdown(l, r, index);
    if (start <= l && r <= end) {
        tree[index].lz += val;
        tree[index].value += val;
        return;
    }

    if (end <= MID) {
        update(start, end, l, MID, LEFT, val);
    } else if (start >= MID + 1) {
        update(start, end, MID + 1, r, RIGHT, val);
    } else {
        update(start, end, l, MID, LEFT, val);
        update(start, end, MID + 1, r, RIGHT, val);
    }

    // TODO
    tree[index].value = max(tree[LEFT].value, tree[RIGHT].value);
}

int main() {
    int i, h, n, len, ans = 0;
    scanf("%d%d%d", &n, &len, &h);
    for (i = 1; i <= len; ++i) {
        scanf("%d", &b[i]);
        b[i] = h - b[i];
    }

    sort(b + 1, b + 1 + len);
    for (i = 1; i <= len; ++i) {
        if (i == 1 || b[i] != b[i-1]) {
            disc.push_back(b[i]);
        }
    }

    int sz = disc.size();
    for (i = 1; i <= len; ++i) {
        int index = lower_bound(disc.begin(), disc.end(), b[i]) - disc.begin();
        update(0, index, 0, sz - 1, 1, 1);
        // cout << "update " << 0 << " " << index << " by " << 1 << endl;
    }

    for (i = 1; i <= n; ++i) {
        scanf("%d", &a[i]);
    }

    for (i = 1; i <= n; ++i) {
        // can match with all b between [index, sz -1]
        int index;
        if (i > len) {
            // withdraw a[i-len]
            index = upper_bound(disc.begin(), disc.end(), a[i-len]) - disc.begin() - 1;
            update(0, index, 0, sz - 1, 1, 1);
            // cout << "withdraw " << 0 << " " << index << endl;
        }
        index = upper_bound(disc.begin(), disc.end(), a[i]) - disc.begin() - 1;
        // update the affect of a[i]
        update(0, index, 0, sz - 1, 1, -1);
        // cout << "update " << 0 << " " << index << " by -1 " << endl;
        // update answer
        if (i >= len) {
            ans += tree[1].value <= 0;
        }
    }

    printf("%d\n", ans);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 150003;

int n, len, h;
int b[MAXN], a[MAXN];
void read()
{
	cin >> n >> len >> h;

    for (int i = 1; i <= len; i++)
	cin >> b[i];

    for (int i = 1; i <= n; i++)
	cin >> a[i];
}

int tr[MAXN * 4], lazy[MAXN * 4];

void merge(int v) {tr[v] = min(tr[v * 2], tr[v * 2 + 1]);}

void build(int v, int l, int r)
{
	if (l == r)
	{
		tr[v] = -len + l - 1;

		return;
	}

	int mid = (l + r) / 2;

	build(v * 2, l, mid);
	build(v * 2 + 1, mid + 1, r);

	merge(v);
}

void push(int v, int l, int r)
{
	tr[v] += lazy[v];

	if (l != r)
		lazy[v * 2] += lazy[v], lazy[v * 2 + 1] += lazy[v];

	lazy[v] = 0;
}

void update(int v, int l, int r, int ll, int rr, int val)
{
	push(v, l, r);

	if (l > rr || r < ll)
		return;

	if (l >= ll && r <= rr)
	{
		lazy[v] += val;
		push(v, l, r);

		return;
	}

	int mid = (l + r) / 2;

	update(v * 2, l, mid, ll, rr, val);
	update(v * 2 + 1, mid + 1, r, ll, rr, val);

	merge(v);
}

vector <int> diff;

int find_idx(int val)
{
	auto it = upper_bound(diff.begin(), diff.end(), val);

	if (it == diff.begin())
		return -1;

	return it - diff.begin();
}

void solve()
{
	for (int i = 1; i <= len; i++)
		diff.push_back(h - b[i]);

	sort (diff.begin(), diff.end());

    build(1, 1, len);

	for (int i = 1; i <= len; i++)
       {
		   int curr_idx = find_idx(a[i]);

		   if (curr_idx != -1)
			   update(1, 1, len, 1, curr_idx, 1);
	   }

	int ans = 0;

	if (tr[1] >= 0)
		ans++;
	for (int i = len + 1; i <= n; i++)
	{
		int curr_idx = find_idx(a[i]);

		if (curr_idx != -1)
			update(1, 1, len, 1, curr_idx, 1);
		curr_idx = find_idx(a[i-len]);

		if (curr_idx != -1)
			update(1, 1, len, 1, curr_idx, -1);

		if (tr[1] >= 0)
			ans++;
	}

	cout << ans << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	read();
	solve();
}


//SalehIsNotComming
#include <bits/stdc++.h>
using namespace std;
#define mid ((s + e) / 2)
#define makefast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define comp(x) (lower_bound(vec.begin(), vec.end(), x) - vec.begin())
#define lc (v * 2)
#define rc (v * 2 + 1)
long long M = 1e9 + 7;
//>>>>>>>>>>>>>>>>>>>

const int N = 2e5 + 7;

vector <int> b;
int a[N];
int n, m, h;
int seg[N * 4];
int laz[N * 4];

void spl(int v) {
	for (int u = lc; u <= rc; u++) {
		seg[u] += laz[v];
		laz[u] += laz[v];
	}
	laz[v] = 0;
}

void add(int l, int r, int val, int v = 1, int s = 0, int e = b.size()) {
	if (r <= s || e <= l)
		return;
	if (l <= s && e <= r) {
		seg[v] += val;
		laz[v] += val;
		return;
	}
	spl(v);
	add(l, r, val, lc, s, mid);
	add(l, r, val, rc, mid, e);
	seg[v] = min(seg[lc], seg[rc]);
}

int sml(int x) {
	 return upper_bound(b.begin(), b.end(), x) - b.begin();
}

int main() {
	cin >> n >> m >> h;
	for (int i = 1; i <= m; i++) {
		int x;
		cin >> x;
		b.push_back(h - x);
	}
	sort (b.begin(), b.end());
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	int res = 0;
	for (int i = m - 1; i >= 0; i--)
		add(i, i + 1, i - m);
	for (int i = 1; i <= m; i++)
		add(0, sml(a[i]), 1);
	if (seg[1] >= 0)
		res++;
	for (int i = m + 1; i <= n; i++) {
		add(0, sml(a[i]), 1);
		add(0, sml(a[i - m]), -1);
		if (seg[1] >= 0)
			res++;
	}
	cout << res;

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

const int N = 2e5 + 5;

int n, len, h, a[N], b[N], ans;

struct node {
	ll mn, mx, lazy;
	node() {
		mn = lazy = 0;
	}
}seg[N << 2];

void shift(int id, int b, int e) {
	if(seg[id].lazy) {
		int mid = (b + e) >> 1, lc = id * 2, rc = lc | 1;
		for (auto x : {lc, rc}) {
			seg[x].mn += seg[id].lazy;
			seg[x].lazy += seg[id].lazy;
		}
		seg[id].lazy = 0;
	}
}

void build(int id = 1, int b = 0, int e = len) {
	if(e - b == 1) {
		seg[id].mn = -(b + 1);
		return;
	}
	int mid = (b + e) >> 1, lc = id * 2, rc = lc | 1;
	build(lc, b, mid);
	build(rc, mid, e);
	seg[id].mn = min(seg[lc].mn, seg[rc].mn);
}

void modify(int l, int r, int val, int id = 1, int b = 0, int e = len) {
	if(l >= e || b >= r)
		return;
	if(l <= b && e <= r) {
		seg[id].mn += val;
		seg[id].lazy += val;
		return;
	}
	shift(id, b, e);
	int mid = (b + e) >> 1, lc = id * 2, rc = lc | 1;
	modify(l, r, val, lc, b, mid);
	modify(l, r, val, rc, mid, e);
	seg[id].mn = min(seg[lc].mn, seg[rc].mn);
}

void add(int pos, int val) {
	if(pos < 0)
		return;
	int l = lower_bound(b, b + len, h - a[pos]) - b, r = len;
	return modify(l, r, val);
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> len >> h;
	for (int i = 0; i < len; i++)
		cin >> b[i];
	sort(b, b + len);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	build();
	for (int i = 0; i < len - 1; i++)
		add(i, 1);
	for (int i = len - 1; i < n; i++) {
		add(i - len, -1);
		add(i, 1);
	//	cout << i - len + 2 << " " << seg[1].ok << "\n";
		ans += seg[1].mn >= 0;
	}
	cout << ans << "\n";
}


// be name khoda \\

// #define stream_enable
#define long_enable
#define debug_enable

#include <iostream>
#include <map>
#include <iomanip>
#include <vector>
#include <set>
#include <cmath>
#include <utility>
#include <algorithm>
#include <sstream>
#include <queue>
#include <stack>
#include <limits.h>
#include <fstream>
#include <cstring>

using namespace std;

#ifdef stream_enable
#define cin sss
#endif

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef pair<ll, pii> pip;
typedef pair<pii, ll> ppi;
typedef pair<pii, pii> ppp;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef vector<pii> vpii;
typedef vector<pip> vpip;

const ll MOD = 1000000007;

const long long BIG = 1446803456761533460LL;
const int Big = 336860180;

#ifdef long_enable
const ll INF = LONG_LONG_MAX;
#else
const ll INF = INT_MAX;
#endif

const ll adj4[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const ll adj8[8][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}};

#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back

#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define print4(x, y, z, t) cout << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << '\n'
#define printv(x) fori (j12345, (x).size()) { cout << (x)[j12345] << ' '; } cout << '\n'
#define printvv(x) fori (i123456, (x).size()) { fori (j123456, (x)[i123456].size()) { cout << (x)[i123456][j123456] << ' '; } cout << '\n'; }
#define printp(x) cout << "(" << x.ff << ", " << x.ss << ")" << '\n'
#define printvp(x) fori (i1234567, (x).size()) { cout << "(" << x[i1234567].ff << ", " << x[i1234567].ss << ")" << '\n'; }
#define printa(x, n) fori (ja12345, n) { cout << (x)[ja12345] << ' '; } cout << '\n'
#define printap(x, n) fori (ia1234567, n) { cout << "(" << x[ia1234567].ff << ", " << x[ia1234567].ss << ")" << '\n'; }
#define printaa(x, n, m) fori (iaa123456, n) { fori (jaa123456, m) { cout << (x)[iaa123456][jaa123456] << ' '; } cout << '\n'; }
#define printav(x, n) fori (iaa123477, n) { printv(x[iaa123477]); }
#define printia(x, n) fori (ja212345, n) { cout << ja212345 << " : " << (x)[ja212345] << '\n'; }

#ifdef debug_enable
#define debug(x) cout << #x << " -> "; print(x)
#define debug2(x, y) cout << #x << ' ' << #y << " -> "; print2(x, y)
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> "; print3(x, y, z)
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> "; print4(x, y, z, t)
#define debugv(x) cout << #x << " -> "; printv(x)
#define debugvv(x) cout << #x << " ->\n"; printvv(x)
#define debugp(x) cout << #x << " -> "; printp(x)
#define debugvp(x) cout << #x << " ->\n"; printvp(x)
#define debuga(x, n) cout << #x << " -> "; printa(x, n)
#define debugap(x, n) cout << #x << " ->\n"; printap(x, n)
#define debugaa(x, n, m) cout << #x << " ->\n"; printaa(x, n, m)
#define debugav(x, n) cout << #x << " ->\n"; printav(x, n)
#define debugia(x, n) cout << #x << " ->\n"; printia(x, n)
ll clk_ar[10];
#define clk_s(i) clk_ar[i] = clock();
#define clk_e(i) cout << "Clock " << i << " : " << (double) (clock() - clk_ar[i]) / CLOCKS_PER_SEC << " sec\n";
#else
#define debug(x)
#define debug2(x, y)
#define debug3(x, y, z)
#define debug4(x, y, z, t)
#define debugv(x)
#define debugvv(x)
#define debugp(x)
#define debugvp(x)
#define debuga(x, n)
#define debugap(x, n)
#define debugaa(x, n, m)
#define debugav(x, n, m)
#define debugia(x, n)
#define clk_s(i)
#define clk_e(i)
#endif

#define fori(i, n) for(ll i = 0; i < (n); ++i)
#define forir(i, n) for(ll i = (n) - 1; i >= 0; --i)
#define forifrom(i, f, n) for(ll i = (f); i < (n); ++i)
#define forirto(i, n, f) for(ll i = (n) - 1; i >= (f); --i)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define inp(x) ll x; cin >> x
#define inp2(x, y) ll x, y; cin >> x >> y
#define inp3(x, y, z) ll x, y, z; cin >> x >> y >> z
#define inp4(x, y, z, w) ll x, y, z, w; cin >> x >> y >> z >> w

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll powMod(ll a, ll b) {
    ll n = 1;
    ll p = a;
    while (b > 0) {
        if (b % 2 == 1) {
            n *= p;
            n %= MOD;
        }
        p *= p;
        p %= MOD;
        b /= 2;
    }
    return n;
}

ll modularInverse(ll a) {
    return powMod(a, MOD - 2);
}

ll binarysearch(ll l, ll r, bool (*bsfunction) (ll)) {
    while (r - l > 1) {
        ll mid = (l + r) / 2;
        bool val = bsfunction(mid);
        if (val) {
            r = mid;
        } else {
            l = mid;
        }
    }
    return l;
}

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 150010;

ll fen[maxn];
ll a[maxn];
ll b[maxn];
ll idxs[maxn];

void update(ll i, ll v) {
    for (++i; i < maxn; i += i & (-i)) fen[i] += v;
}

ll get(ll i) {
    ll s = 0;
    for (++i; i > 0; i -= i & (-i)) s += fen[i];
    return s;
}

void MAIN() {

    inp3(n, m, h);
    fori (i, m) {
        cin >> b[i];
    }
    fori (i, n) {
        cin >> a[i];
        a[i] = h - a[i];
    }

    sort(b, b + m, greater<ll>());
    fori (i, n) {
        idxs[i] = lower_bound(b, b + m, a[i], greater_equal<ll>()) - b;
    }

    // debuga(b, m);
    // debuga(idxs, n);

    ll res = 0;
    ll ptr = 0;
    forifrom (i, m - 1, n) {
        while (ptr <= i) {
            ll idx = idxs[ptr];
            if (get(idx) + 1 > idx) {
                break;
            } else {
                update(idx, 1);
                ++ptr;
            }
        }
        // debug2(i, ptr);
        if (ptr > i) {
            // debug(i);
            ++res;
        }
        ll idx = idxs[i - (m - 1)];
        update(idx, -1);
    }
    print(res);
}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(
11 6 10
4 4 8 8 12 12
8 2 8 3 9 50 3 4 2 1 3

6 3 5
10 3 10
1 2 2 2 1 2

5 2 10
5 3
1 8 5 5 7

10 4 10
7 5 3 5
1 8 5 5 7 3 40 10 9 5
    )";
    MAIN();
    return 0;
}


// be name khoda \\

// #define stream_enable
#define long_enable
#define debug_enable

#include <iostream>
#include <map>
#include <iomanip>
#include <vector>
#include <set>
#include <cmath>
#include <utility>
#include <algorithm>
#include <sstream>
#include <queue>
#include <stack>
#include <limits.h>
#include <fstream>
#include <cstring>

using namespace std;

#ifdef stream_enable
#define cin sss
#endif

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef pair<ll, pii> pip;
typedef pair<pii, ll> ppi;
typedef pair<pii, pii> ppp;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef vector<pii> vpii;
typedef vector<pip> vpip;

const ll MOD = 1000000007;

const long long BIG = 1446803456761533460LL;
const int Big = 336860180;

#ifdef long_enable
const ll INF = LONG_LONG_MAX;
#else
const ll INF = INT_MAX;
#endif

const ll adj4[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const ll adj8[8][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}};

#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back

#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define print4(x, y, z, t) cout << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << '\n'
#define printv(x) fori (j12345, (x).size()) { cout << (x)[j12345] << ' '; } cout << '\n'
#define printvv(x) fori (i123456, (x).size()) { fori (j123456, (x)[i123456].size()) { cout << (x)[i123456][j123456] << ' '; } cout << '\n'; }
#define printp(x) cout << "(" << x.ff << ", " << x.ss << ")" << '\n'
#define printvp(x) fori (i1234567, (x).size()) { cout << "(" << x[i1234567].ff << ", " << x[i1234567].ss << ")" << '\n'; }
#define printa(x, n) fori (ja12345, n) { cout << (x)[ja12345] << ' '; } cout << '\n'
#define printap(x, n) fori (ia1234567, n) { cout << "(" << x[ia1234567].ff << ", " << x[ia1234567].ss << ")" << '\n'; }
#define printaa(x, n, m) fori (iaa123456, n) { fori (jaa123456, m) { cout << (x)[iaa123456][jaa123456] << ' '; } cout << '\n'; }
#define printav(x, n) fori (iaa123477, n) { printv(x[iaa123477]); }
#define printia(x, n) fori (ja212345, n) { cout << ja212345 << " : " << (x)[ja212345] << '\n'; }

#ifdef debug_enable
#define debug(x) cout << #x << " -> "; print(x)
#define debug2(x, y) cout << #x << ' ' << #y << " -> "; print2(x, y)
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> "; print3(x, y, z)
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> "; print4(x, y, z, t)
#define debugv(x) cout << #x << " -> "; printv(x)
#define debugvv(x) cout << #x << " ->\n"; printvv(x)
#define debugp(x) cout << #x << " -> "; printp(x)
#define debugvp(x) cout << #x << " ->\n"; printvp(x)
#define debuga(x, n) cout << #x << " -> "; printa(x, n)
#define debugap(x, n) cout << #x << " ->\n"; printap(x, n)
#define debugaa(x, n, m) cout << #x << " ->\n"; printaa(x, n, m)
#define debugav(x, n) cout << #x << " ->\n"; printav(x, n)
#define debugia(x, n) cout << #x << " ->\n"; printia(x, n)
ll clk_ar[10];
#define clk_s(i) clk_ar[i] = clock();
#define clk_e(i) cout << "Clock " << i << " : " << (double) (clock() - clk_ar[i]) / CLOCKS_PER_SEC << " sec\n";
#else
#define debug(x)
#define debug2(x, y)
#define debug3(x, y, z)
#define debug4(x, y, z, t)
#define debugv(x)
#define debugvv(x)
#define debugp(x)
#define debugvp(x)
#define debuga(x, n)
#define debugap(x, n)
#define debugaa(x, n, m)
#define debugav(x, n, m)
#define debugia(x, n)
#define clk_s(i)
#define clk_e(i)
#endif

#define fori(i, n) for(ll i = 0; i < (n); ++i)
#define forir(i, n) for(ll i = (n) - 1; i >= 0; --i)
#define forifrom(i, f, n) for(ll i = (f); i < (n); ++i)
#define forirto(i, n, f) for(ll i = (n) - 1; i >= (f); --i)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define inp(x) ll x; cin >> x
#define inp2(x, y) ll x, y; cin >> x >> y
#define inp3(x, y, z) ll x, y, z; cin >> x >> y >> z
#define inp4(x, y, z, w) ll x, y, z, w; cin >> x >> y >> z >> w

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll powMod(ll a, ll b) {
    ll n = 1;
    ll p = a;
    while (b > 0) {
        if (b % 2 == 1) {
            n *= p;
            n %= MOD;
        }
        p *= p;
        p %= MOD;
        b /= 2;
    }
    return n;
}

ll modularInverse(ll a) {
    return powMod(a, MOD - 2);
}

ll binarysearch(ll l, ll r, bool (*bsfunction) (ll)) {
    while (r - l > 1) {
        ll mid = (l + r) / 2;
        bool val = bsfunction(mid);
        if (val) {
            r = mid;
        } else {
            l = mid;
        }
    }
    return l;
}

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 150010;

ll fen[maxn];
ll a[maxn];
ll b[maxn];

void update(ll i, ll v) {
    for (++i; i < maxn; i += i & (-i)) fen[i] += v;
}

ll get(ll i) {
    ll s = 0;
    for (++i; i > 0; i -= i & (-i)) s += fen[i];
    return s;
}

void MAIN() {

    inp3(n, m, h);
    fori (i, m) {
        cin >> b[i];
    }
    fori (i, n) {
        cin >> a[i];
        a[i] = h - a[i];
    }

    sort(b, b + m, greater<ll>());

    // debuga(b, m);
    // debuga(a, n);

    ll res = 0;
    ll ptr = 0;
    forifrom (i, m - 1, n) {
        while (ptr <= i) {
            ll idx = lower_bound(b, b + m, a[ptr], greater_equal<ll>()) - b;
            if (get(idx) + 1 > idx) {
                break;
            } else {
                update(idx, 1);
                ++ptr;
            }
        }
        // debug2(i, ptr);
        if (ptr > i) {
            ++res;
        }
        ll idx = lower_bound(b, b + m, a[i - (m - 1)], greater_equal<ll>()) - b;
        update(idx, -1);
    }
    print(res);
}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(
6 1 5
3
1 2 2 2 1 2

5 2 10
5 3
1 8 5 5 7

10 4 10
7 5 3 5
1 8 5 5 7 3 40 10 9 5
    )";
    MAIN();
    return 0;
}


// be name khoda \\

// #define stream_enable
#define long_enable
#define debug_enable

#include <iostream>
#include <map>
#include <iomanip>
#include <vector>
#include <set>
#include <cmath>
#include <utility>
#include <algorithm>
#include <sstream>
#include <queue>
#include <stack>
#include <limits.h>
#include <fstream>
#include <cstring>

using namespace std;

#ifdef stream_enable
#define cin sss
#endif

#ifdef long_enable
typedef long long int ll;
#else
typedef int ll;
#endif

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef pair<ll, pii> pip;
typedef pair<pii, ll> ppi;
typedef pair<pii, pii> ppp;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef vector<pii> vpii;
typedef vector<pip> vpip;

const ll MOD = 1000000007;

const long long BIG = 1446803456761533460LL;
const int Big = 336860180;

#ifdef long_enable
const ll INF = LONG_LONG_MAX;
#else
const ll INF = INT_MAX;
#endif

const ll adj4[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
const ll adj8[8][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}};

#define mp make_pair
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back

#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define print4(x, y, z, t) cout << (x) << ' ' << (y) << ' ' << (z) << ' ' << (t) << '\n'
#define printv(x) fori (j12345, (x).size()) { cout << (x)[j12345] << ' '; } cout << '\n'
#define printvv(x) fori (i123456, (x).size()) { fori (j123456, (x)[i123456].size()) { cout << (x)[i123456][j123456] << ' '; } cout << '\n'; }
#define printp(x) cout << "(" << x.ff << ", " << x.ss << ")" << '\n'
#define printvp(x) fori (i1234567, (x).size()) { cout << "(" << x[i1234567].ff << ", " << x[i1234567].ss << ")" << '\n'; }
#define printa(x, n) fori (ja12345, n) { cout << (x)[ja12345] << ' '; } cout << '\n'
#define printap(x, n) fori (ia1234567, n) { cout << "(" << x[ia1234567].ff << ", " << x[ia1234567].ss << ")" << '\n'; }
#define printaa(x, n, m) fori (iaa123456, n) { fori (jaa123456, m) { cout << (x)[iaa123456][jaa123456] << ' '; } cout << '\n'; }
#define printav(x, n) fori (iaa123477, n) { printv(x[iaa123477]); }
#define printia(x, n) fori (ja212345, n) { cout << ja212345 << " : " << (x)[ja212345] << '\n'; }

#ifdef debug_enable
#define debug(x) cout << #x << " -> "; print(x)
#define debug2(x, y) cout << #x << ' ' << #y << " -> "; print2(x, y)
#define debug3(x, y, z) cout << #x << ' ' << #y << ' ' << #z << " -> "; print3(x, y, z)
#define debug4(x, y, z, t) cout << #x << ' ' << #y << ' ' << #z << ' ' << #t << " -> "; print4(x, y, z, t)
#define debugv(x) cout << #x << " -> "; printv(x)
#define debugvv(x) cout << #x << " ->\n"; printvv(x)
#define debugp(x) cout << #x << " -> "; printp(x)
#define debugvp(x) cout << #x << " ->\n"; printvp(x)
#define debuga(x, n) cout << #x << " -> "; printa(x, n)
#define debugap(x, n) cout << #x << " ->\n"; printap(x, n)
#define debugaa(x, n, m) cout << #x << " ->\n"; printaa(x, n, m)
#define debugav(x, n) cout << #x << " ->\n"; printav(x, n)
#define debugia(x, n) cout << #x << " ->\n"; printia(x, n)
ll clk_ar[10];
#define clk_s(i) clk_ar[i] = clock();
#define clk_e(i) cout << "Clock " << i << " : " << (double) (clock() - clk_ar[i]) / CLOCKS_PER_SEC << " sec\n";
#else
#define debug(x)
#define debug2(x, y)
#define debug3(x, y, z)
#define debug4(x, y, z, t)
#define debugv(x)
#define debugvv(x)
#define debugp(x)
#define debugvp(x)
#define debuga(x, n)
#define debugap(x, n)
#define debugaa(x, n, m)
#define debugav(x, n, m)
#define debugia(x, n)
#define clk_s(i)
#define clk_e(i)
#endif

#define fori(i, n) for(ll i = 0; i < (n); ++i)
#define forir(i, n) for(ll i = (n) - 1; i >= 0; --i)
#define forifrom(i, f, n) for(ll i = (f); i < (n); ++i)
#define forirto(i, n, f) for(ll i = (n) - 1; i >= (f); --i)

#define smin(a, b) a = min(a, (b))
#define smax(a, b) a = max(a, (b))

#define inp(x) ll x; cin >> x
#define inp2(x, y) ll x, y; cin >> x >> y
#define inp3(x, y, z) ll x, y, z; cin >> x >> y >> z
#define inp4(x, y, z, w) ll x, y, z, w; cin >> x >> y >> z >> w

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll powMod(ll a, ll b) {
    ll n = 1;
    ll p = a;
    while (b > 0) {
        if (b % 2 == 1) {
            n *= p;
            n %= MOD;
        }
        p *= p;
        p %= MOD;
        b /= 2;
    }
    return n;
}

ll modularInverse(ll a) {
    return powMod(a, MOD - 2);
}

ll binarysearch(ll l, ll r, bool (*bsfunction) (ll)) {
    while (r - l > 1) {
        ll mid = (l + r) / 2;
        bool val = bsfunction(mid);
        if (val) {
            r = mid;
        } else {
            l = mid;
        }
    }
    return l;
}

stringstream sss;

// -----------------------------------------------------------------------

const ll maxn = 150010;

ll n, m, h;
ll a[maxn];
ll b[maxn];
ll idxs[maxn];

ll seg[maxn * 4];
ll lazy[maxn * 4];

void build(ll x = 1, ll l = 0, ll r = n) {
    if (r - l == 1) {
        seg[x] = l;
    } else {
        ll mid = (l + r) / 2;
        build(x * 2, l, mid);
        build(x * 2 + 1, mid, r);
        seg[x] = min(seg[x * 2], seg[x * 2 + 1]);
    }
}

void push(ll x) {
    seg[x * 2] += lazy[x];
    lazy[x * 2] += lazy[x];
    seg[x * 2 + 1] += lazy[x];
    lazy[x * 2 + 1] += lazy[x];
    lazy[x] = 0;
}

void update(ll li, ll ri, ll v, ll x = 1, ll l = 0, ll r = n) {
    if (li >= r || l >= ri) {
    } else if (li <= l && r <= ri) {
        seg[x] += v;
        lazy[x] += v;
    } else {
        if (lazy[x]) {
            push(x);
        }
        ll mid = (l + r) / 2;
        update(li, ri, v, x * 2, l, mid);
        update(li, ri, v, x * 2 + 1, mid, r);
        seg[x] = min(seg[x * 2], seg[x * 2 + 1]);
    }
}

void MAIN() {

    cin >> n >> m >> h;
    fori (i, m) {
        cin >> b[i];
    }
    fori (i, n) {
        cin >> a[i];
        a[i] = h - a[i];
    }

    sort(b, b + m, greater<ll>());
    fori (i, n) {
        idxs[i] = lower_bound(b, b + m, a[i], greater_equal<ll>()) - b;
    }

    build();

    ll res = 0;
    ll ptr = 0;
    forifrom (i, m - 1, n) {
        while (ptr <= i) {
            ll idx = idxs[ptr];
            update(idx, n, -1);
            if (seg[1] < 0) {
                update(idx, n, 1);
                break;
            } else {
                ++ptr;
            }
        }
        if (ptr > i) {
            ++res;
        }
        ll idx = idxs[i - (m - 1)];
        update(idx, n, 1);
    }
    print(res);
}

// -----------------------------------------------------------------------

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    sss << R"(
5 3 10
2 5 7
6 6 4 0 0

11 6 10
4 4 8 8 12 12
8 2 8 3 9 50 3 4 2 1 3

6 3 5
3 3 3
1 2 2 2 1 2

5 2 10
5 3
1 8 5 5 7

10 4 10
7 5 3 5
1 8 5 5 7 3 40 10 9 5
    )";
    MAIN();
    return 0;
}


#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define EPS 1e-10
#define setNil(x) memset((x),0,sizeof(x))
#define setINF(x) memset((x),63,sizeof(x))
#define setNegINF(x) memset((x),192,sizeof(x)) //NegINF=-INF-1
#define setNeg1(x) memset((x),255,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=150005;
struct node{
	int ls,rs,mi,sum;
}sgt[34*N];
int n,len,h,a[N],b[N],ls[34*N],rs[34*N],mi[34*N],sum[34*N],cnt,rt,ans;
void update(int &x,int l,int r,int p,int v){
	if(!x)x=++cnt;
	sum[x]+=v;
	if(l==r){
		mi[x]+=v;
		return;
	}
	int mid=(l+r)>>1;
	if(p<=mid)update(ls[x],l,mid,p,v);
	else update(rs[x],mid+1,r,p,v);
	mi[x]=min(mi[ls[x]],sum[ls[x]]+mi[rs[x]]);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>len>>h;
	for(int i=1;i<=len;i++){
		cin>>b[i];
		update(rt,1,1e9,max(h-b[i],1),1);
	}
	for(int i=1;i<=n;i++){
		cin>>a[i];
		update(rt,1,1e9,a[i],-1);
		if(i>len)update(rt,1,1e9,a[i-len],1);
		ans+=(i>=len && mi[rt]>=0);
	}
	cout<<ans<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

using i64 = long long;
#define forn(a, e) for (i64 a = 0; a < (i64)(e); a++)
#define forr(a, s, e) for (i64 a = s; a < (i64)(e); a++)
#define fore(e, a) for (auto& e : a)

#ifdef LOCAL
#define logv(a) {cerr << #a << " = "; fore(e, a) {cerr << e << " ";} cerr << "\n";}
#define logvp(a) {cerr << #a << " = "; fore(e, a) {cerr << "(" << e.first << ", " << e.second << ") ";} cerr << "\n";}
#define logvv(a) {cerr << #a << " = \n"; fore(r, a) { fore(e, r) {cerr << e << " ";} cerr << "\n";} }
#define logvf(a, field) {cerr << #a"."#field << " = \n"; fore(e, a) { cerr << e.field << " ";} cerr << "\n"; }
#define logvff(a, f1, f2) {cerr << #a".{"#f1 << ", "#f2 << "} = \n"; fore(e, a) { cerr << "(" << e.f1 <<", " << e.f2 << ") ";} cerr << "\n"; }
#define logs(a) cerr << #a << " = " << (a) << "\n";
#define logss(a, b) cerr << #a << " = " << (a) << ", " << #b << " = " << (b) << "\n";
#define logp(a) cerr << #a << " = " << "(" << a.first << ", " << a.second << ")" << "\n";
#define cond(pred, stmt) if (pred) { stmt }
#else
#define logv(a)
#define logvp(a)
#define logvv(a)
#define logvf(a, field)
#define logvff(a, f1, f2)
#define logs(a)
#define logss(a, b)
#define logp(a)
#define cond(pred, stmt)
#endif

using iip = pair<int, int>;
using llp = pair<i64, i64>;
using ivec = vector<int>;
using llvec = vector<i64>;
using svec = vector<string>;
template<typename T> using vec = vector<T>;

template<typename T, typename Dim>
auto make_vec(T value, Dim dim) { return vector<T>(dim, value); }
template<typename T, typename Dim1, typename... Dim>
auto make_vec(T value, Dim1 dim1, Dim... dims) { return make_vec(make_vec(value, dims...), dim1); }

template<typename T>
bool uax(T& v, const T& newv) { if (v < newv) { v = newv; return true; } else return false; }
template<typename T>
bool uin(T& v, const T& newv) { if (v > newv) { v = newv; return true; } else return false; }

template<typename T>
istream& operator>>(istream& is, vector<T>& c) { for (auto& e : c) is >> e; return is; }
template<typename T, size_t N>
istream& operator>>(istream& is, array<T, N>& c) { for (auto& e : c) is >> e; return is; }

template<typename ...T>
istream& read(T&... args) { return (cin >> ... >> args); }

static mt19937 rande(123123);
template<typename T>
T rand_int(T from, T to) { uniform_int_distribution<T> distr(from, to); return distr(rande); }

constexpr int INF = 1e9;
constexpr int MXB = 20;
using bin = bitset<MXB>;
constexpr i64 M = 1e9 + 7;

template<typename T, typename S>
struct SegTree {
    vector<T> data;
    vector<S> lazy;
    int N, height;
    T idVal;
    S noLazy;
    function<void(T &, S const&)> nodeMod;
    function<T(T const&, T const&)> combine;
    function<S(S const&, S const&)> lazyCombine;
    SegTree(vector<T> const&base, T const& identity_value, S const& no_lazy_value, function<void(T &, S const&)> const&node_update, function<T(T const&, T const&)> const&subtree_combine, function<S(S const&, S const&)>combine_lazy_values):N(base.size()), height(__builtin_clz(1)-__builtin_clz(N)), idVal(identity_value),noLazy(no_lazy_value), nodeMod(node_update), combine(subtree_combine), lazyCombine(combine_lazy_values){
        data.resize(2*N);
        lazy.resize(2*N, noLazy);
        copy(base.begin(), base.end(), data.begin()+N);
        for(int i=N-1;i>=0;--i){
            data[i]=combine(data[i<<1], data[i<<1|1]);
        }
    }
    void localUpdate(int pos, S const&val){
        nodeMod(data[pos], val);
        if(pos<N) lazy[pos] = lazyCombine(lazy[pos], val);
    }
    void push(int pos){
        for(int s=height;s>0;--s){
            int i=pos>>s;
            if(lazy[i]!=noLazy){
                localUpdate(i<<1, lazy[i]);
                localUpdate(i<<1|1, lazy[i]);
                lazy[i]=noLazy;
            }
        }
    }
    void rePath(int pos){
        while(pos>>=1) nodeMod(data[pos] = combine(data[pos<<1], data[pos<<1|1]), lazy[pos]);
    }
    void update(int l, int r, S const&val){
        int l2=l+=N, r2=r+=N;
        push(l2); push(r2-1);
        for(;l<r;l>>=1, r>>=1){
            if(l&1) localUpdate(l++, val);
            if(r&1) localUpdate(--r, val);
        }
        rePath(l2);rePath(r2-1);
    }
    T query(int l, int r){
        push(l+N); push(r+N-1);
        T retL=idVal, retR=idVal;
        for(l+=N, r+=N;l<r;l>>=1, r>>=1){
            if(l&1)retL=combine(retL, data[l++]);
            if(r&1)retR=combine(data[--r], retR);
        }
        return combine(retL, retR);
    }
};

void update(int& v, int lv) {
    v += lv;
}

int combine_sum(int a, int b) {
    return a + b;
}

int combine_min(int a, int b) {
    return min(a, b);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    rande.seed(chrono::steady_clock::now().time_since_epoch().count());

    int n, l, h;
    while (read(n, l, h)) {
        ivec b(l);
        ivec a(n);
        read(b, a);

        fore(bi, b) {
            bi = h - bi;
        }
        sort(b.begin(), b.end());

        ivec cc(l);
        forn(i, l) {
            cc[i] = - (l - i);
        }

        logv(cc);
        logv(b);

        SegTree<int, int> stree(cc, INF, 0, update, combine_min, combine_sum);
        forn(i, l - 1) {
            int p = upper_bound(b.begin(), b.end(), a[i]) - b.begin();
            if (p > 0) {
                stree.update(0, p, 1);
            }
        }
        int ans = 0;
        forr(i, l - 1, n) {
            int p = upper_bound(b.begin(), b.end(), a[i]) - b.begin();
            logss(i, p);
            if (p > 0) {
                stree.update(0, p, 1);
            }
            int mn = stree.query(0, b.size());
            ans += (mn >= 0);

            int lp = upper_bound(b.begin(), b.end(), a[i - l + 1]) - b.begin();
            logss(mn, lp);

            if (lp > 0) {
                stree.update(0, lp, -1);
            }
        }
        cout << ans << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int N = (int)3e5 + 50;

#define lson(x) 2*x+1
#define rson(x) 2*x+2

struct node {
    int lmax, sum;

    void set_node(int val) {
        sum = val;
        lmax = max(0, val);
    }

    void merge(node &LHS, node &RHS) {
        sum = LHS.sum + RHS.sum;
        lmax = max(LHS.lmax, LHS.sum + RHS.lmax);
    }
};

int val[N];

struct Tree {
    node dat[N * 4];

    void init_dat(int x, int l, int r){
        if(l == r){
            dat[x].set_node(val[l]);
            return ;
        }

        int mid = (l + r) / 2;
        init_dat(lson(x), l, mid);
        init_dat(rson(x), mid+1, r);
        dat[x].merge(dat[lson(x)], dat[rson(x)]);
    }

    void update(int pos, int x, int l, int r, int d){
        int mid = (l + r) / 2;
        if(l == r) {
            dat[x].set_node(dat[x].sum + d);
            return ;
        }
        if(pos <= mid) update(pos, lson(x), l, mid, d);
        else update(pos, rson(x), mid+1, r, d);
        dat[x].merge(dat[lson(x)], dat[rson(x)]);
    }
} tree;

int n, m, len, h;
int a[N], b[N];
vi vals;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> m >> h;
    rep(i, 0, m) cin >> b[i], vals.push_back(b[i]);
    rep(i, 0, n) cin >> a[i], a[i] = h - a[i], vals.push_back(a[i]);
    sort(all(vals));
    vals.resize(unique(all(vals)) - vals.begin());
    rep(i, 0, m) b[i] = (lower_bound(all(vals), b[i]) - vals.begin()), val[b[i]]++;
    rep(i, 0, n) a[i] = (lower_bound(all(vals), a[i]) - vals.begin());
    len = sz(vals);
    rep(i, 0, m) val[a[i]]--;
    tree.init_dat(0, 0, len - 1);
    int ans = (tree.dat[0].lmax == 0);
    rep(i, m, n) {
        tree.update(a[i - m], 0, 0, len - 1, 1);
        tree.update(a[i], 0, 0, len - 1, -1);
        ans += (tree.dat[0].lmax == 0);
    }
    cout << ans << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

template<int MAXN>
struct segtree_lazy {

	struct updater {
		/* DATA MEMBERS */
		int x;

		updater(int x = 0) : x(x) {}

		updater& operator+= (const updater& other) {
			/* ADDITION */
			x += other.x;

			return *this;
		}

		operator bool () const {
			/* BOOL CAST */
			return x != 0;
		}
	};

	struct node_t {
		/* DATA MEMBERS */
		int x;

		/* CONSTRUCTOR */
		node_t(int x = 1123123123) : x(x) {}

		node_t& operator+= (const node_t& other) {
			/* ADDITION */
			x = min(x, other.x);

			return *this;
		}

		node_t& operator+= (const updater& other) {
			/* UPDATE ADDITION */
			x += other.x;

			return *this;
		}

		node_t operator+ (const node_t& other) const {
			node_t tmp = *this;
			tmp += other;
			return tmp;
		}
	};

	node_t a[2*MAXN];
	updater b[2*MAXN];

	void init() {
		for (int i=0; i<2*MAXN; i++)
			a[i] = node_t(0);
	}

	void push(int i) {
		if (b[i]) {
			a[i] += b[i];
			if (i < MAXN) {
				b[2*i] += b[i];
				b[2*i+1] += b[i];
			}
			b[i] = updater();
		}
	}

	node_t get(int l, int r, int node=1, int nl=0, int nr=MAXN-1) {
		push(node);

		if (r < nl || nr < l) {
			return node_t();
		}
		if (l <= nl && nr <= r) {
			return a[node];
		}

		int nm = (nl + nr) >> 1;
		return get(l, r, 2*node, nl, nm) + get(l, r, 2*node+1, nm+1, nr);
	}

	void update(int l, int r, updater val, int node=1, int nl=0, int nr=MAXN-1) {
		push(node);

		if (r < nl || nr < l) {
			return;
		}
		if (l <= nl && nr <= r) {
			b[node] += val;
			push(node);
			return;
		}

		int nm = (nl + nr) >> 1;
		update(l, r, val, 2*node, nl, nm);
		update(l, r, val, 2*node+1, nm+1, nr);
		a[node] = a[2*node] + a[2*node+1];
	}
};

segtree_lazy<262144> drvo;

int n, m;
int a[150005], b[150005], h;

void dodaj(int x, int z) {
	auto it = lower_bound(b, b+m, h-x) - b;
	drvo.update(it, m-1, z);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	drvo.init();

	cin >> n >> m >> h;

	for (int i=0; i<m; i++)
		cin >> b[i];
	for (int i=0; i<n; i++)
		cin >> a[i];

	sort(b, b+m);

	for (int i=0; i<m; i++)
		drvo.update(i, m-1, -1);

	for (int j=0; j<m; j++)
		dodaj(a[j], 1);

	int sol = 0;

	for (int i=0; i<=n-m; i++) {
		sol += drvo.get(0, m-1).x >= 0;
		dodaj(a[i+m], 1);
		dodaj(a[i], -1);
	}

	cout << sol << '\n';
}


#pragma comment (linker, "/STACK:100000000")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define FILL(A,value) memset(A,value,sizeof(A))
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair

typedef long long Int;
typedef vector <int> VI;
typedef pair <int, int> PII;

const int INF = 1000000000;
const int MAX = 1<<19;
const int MAX2 = 1<<18;

#define MOD 1000000009
#define K 300

int n, m, h;
int A[MAX];
int B[MAX];
int AA[MAX];
int BB[MAX];
int I[MAX];
int C[MAX];

int D[MAX];
int W[MAX];
int M[MAX];

int Cnt[MAX];

void upd(int x)
{
    int m = INF;
    FOR (i,x*K,x*K+K)
    {
        W[i] += D[x];
        m = min(m, W[i]);
    }
    M[x] = m;
    D[x] = 0;
}

void add(int l, int r, int d)
{
    int ll = l;
    while (l <= r)
        if ((l % K == 0) && (l+K-1 <= r))
        {
            if (D[l] < INF)
                D[l] += d;
            l += K;
        }
        else
        {
            if (W[l] < INF)
            {
                W[l] += d;
            }
            if (((l+1) % K == 0) || l == r)
                upd(l / K);
            l ++;
        }
}

void add(int x)
{
    W[x] = (Cnt[x] == 0 ? W[x] - INF + C[x] : W[x]);
    upd(x / K);
    add(x, n-1, -1);
    ++ Cnt[x];
}

void del(int x)
{
    add(x, n-1, 1);
    -- Cnt[x];
    W[x] = (Cnt[x] == 0 ? W[x] - C[x] + INF : W[x]);
    upd(x / K);
}

int get()
{
    int res = INF;
    for (int i = 0; i < n; i += K)
    {
        if (i+K-1 < n)
            res = min(res, M[i/K] + D[i/K]);
        else
        {
            FOR (j,i,n)
                res = min(res, W[j] + D[j/K]);
        }
    }
    return res;
}

int main()
{
    scanf("%d %d %d", &n, &m, &h);
    FOR (i,0,m)
    {
        scanf("%d", &B[i]);
        BB[i] = B[i];
    }
    FOR (i,0,n)
    {
        scanf("%d", &A[i]);
        AA[i] = A[i];
    }
    sort(AA, AA+n);
    sort(BB, BB+m);
    FOR (i,0,n)
    {
        int pos = lower_bound(BB, BB+m, h - AA[i]) - BB;
        C[i] = m - pos;
        //cout << AA[i] << ' ' << C[i] << endl;
        I[i] = lower_bound(AA, AA+n, A[i]) - AA;
    }
    int res = 0;
    FOR (i,0,n)
    {
        W[i] = M[i] = INF;
        D[i] = 0;
    }
    FOR (i,0,m)
        add(I[i]);
    for (int i = 0; i+m-1 < n; i++)
    {
        /*FOR (j,0,n)
            cout << W[j] << ' ';
        cout << endl;
        cout << endl;*/
        int f = get();
        //cout << f << endl;
        if (f >= 0)
            ++ res;
        del(I[i]);
        if (i+m < n)
            add(I[i+m]);

        /*VI T1;
        VI T2;
        FOR (j,0,m)
            T1.PB(A[i+j]);
        FOR (j,0,m)
            T2.PB(B[j]);
        sort(ALL(T1));
        sort(ALL(T2));
        bool ok = 1;
        FOR (i,0,SZ(T1))
        {
            int pos = lower_bound(ALL(T2), h - T1[i]) - T2.begin();
            int cnt = m - pos;
            if (cnt < i+1)
                ok = 0;
        }
        res += ok;*/
    }
    printf("%d\n", res);

    return 0;
}


#pragma comment (linker, "/STACK:100000000")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define FILL(A,value) memset(A,value,sizeof(A))
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair

typedef long long Int;
typedef vector <int> VI;
typedef pair <int, int> PII;

const int INF = 1000000000;
const int MAX = 1<<19;
const int MAX2 = 1<<18;

#define MOD 1000000009
#define K 300

int n, m, h;
int A[MAX];
int B[MAX];
int AA[MAX];
int BB[MAX];
int I[MAX];
int C[MAX];

int D[MAX];
int W[MAX];
int M[MAX];

int Cnt[MAX];

void upd(int x)
{
    int m = INF;
    FOR (i,x*K,x*K+K)
    {
        W[i] += D[x];
        m = min(m, W[i]);
    }
    M[x] = m;
    D[x] = 0;
}

void add(int l, int r, int d)
{
    int ll = l;
    while (l <= r)
        if ((l % K == 0) && (l+K-1 <= r))
        {
            if (D[l] < INF)
                D[l] += d;
            l += K;
        }
        else
        {
            if (W[l] < INF)
            {
                W[l] += d;
            }
            if (((l+1) % K == 0) || l == r)
                upd(l / K);
            l ++;
        }
}

void add(int x)
{
    W[x] = (Cnt[x] == 0 ? C[x] : W[x]);
    upd(x / K);
    add(x, n-1, -1);
    ++ Cnt[x];
}

void del(int x)
{
    add(x, n-1, 1);
    -- Cnt[x];
    W[x] = (Cnt[x] == 0 ? INF : C[x]);
    upd(x / K);
}

int get()
{
    int res = INF;
    for (int i = 0; i < n; i += K)
    {
        if (i+K-1 < n)
            res = min(res, M[i/K] + D[i/K]);
        else
        {
            FOR (j,i,n)
                res = min(res, W[j] + D[j/K]);
        }
    }
    return res;
}

int main()
{
    scanf("%d %d %d", &n, &m, &h);
    FOR (i,0,m)
    {
        scanf("%d", &B[i]);
        BB[i] = B[i];
    }
    FOR (i,0,n)
    {
        scanf("%d", &A[i]);
        AA[i] = A[i];
    }
    sort(AA, AA+n);
    sort(BB, BB+m);
    FOR (i,0,n)
    {
        int pos = lower_bound(BB, BB+m, h - AA[i]) - BB;
        C[i] = m - pos;
        //cout << AA[i] << ' ' << C[i] << endl;
        I[i] = lower_bound(AA, AA+n, A[i]) - AA;
    }
    int res = 0;
    FOR (i,0,n)
    {
        W[i] = M[i] = INF;
        D[i] = 0;
    }
    FOR (i,0,m)
        add(I[i]);
    for (int i = 0; i+m-1 < n; i++)
    {
        /*FOR (j,0,n)
            cout << W[j] << ' ';
        cout << endl;
        cout << endl;*/
        int f = get();
        //cout << f << endl;
        //if (f >= 0)
        //  ++ res;
        del(I[i]);
        if (i+m < n)
            add(I[i+m]);

        VI T1;
        VI T2;
        FOR (j,0,m)
            T1.PB(A[i+j]);
        FOR (j,0,m)
            T2.PB(B[j]);
        sort(ALL(T1));
        sort(ALL(T2));
        bool ok = 1;
        FOR (i,0,SZ(T1))
        {
            int pos = lower_bound(ALL(T2), h - T1[i]) - T2.begin();
            int cnt = m - pos;
            if (cnt < i+1)
                ok = 0;
        }
        res += ok;
    }
    printf("%d\n", res);

    return 0;
}


#pragma comment (linker, "/STACK:100000000")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define FILL(A,value) memset(A,value,sizeof(A))
#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair

typedef long long Int;
typedef vector <int> VI;
typedef pair <int, int> PII;

const int INF = 1000000000;
const int MAX = 1<<19;
const int MAX2 = 1<<18;

#define MOD 1000000009
#define K 300

int n, m, h;
int A[MAX];
int B[MAX];
int AA[MAX];
int BB[MAX];
int I[MAX];
int C[MAX];

int D[MAX];
int W[MAX];
int M[MAX];

int Cnt[MAX];

void upd(int x)
{
    int m = INF;
    FOR (i,x*K,x*K+K)
    {
        W[i] += D[x];
        m = min(m, W[i]);
    }
    M[x] = m;
    D[x] = 0;
}

void add(int l, int r, int d)
{
    int ll = l;
    while (l <= r)
        if ((l % K == 0) && (l+K-1 <= r))
        {
            if (D[l] < INF)
                D[l] += d;
            l += K;
        }
        else
        {
            if (W[l] < INF)
            {
                W[l] += d;
            }
            if (((l+1) % K == 0) || l == r)
                upd(l / K);
            l ++;
        }
}

void add(int x)
{
    W[x] = (Cnt[x] == 0 ? C[x] : W[x]);
    upd(x / K);
    add(x, n-1, -1);
    ++ Cnt[x];
}

void del(int x)
{
    add(x, n-1, 1);
    -- Cnt[x];
    W[x] = (Cnt[x] == 0 ? INF : C[x]);
    upd(x / K);
}

int get()
{
    int res = INF;
    for (int i = 0; i < n; i += K)
    {
        if (i+K-1 < n)
            res = min(res, M[i/K] + D[i/K]);
        else
        {
            FOR (j,i,n)
                res = min(res, W[j] + D[j/K]);
        }
    }
    return res;
}

int main()
{
    scanf("%d %d %d", &n, &m, &h);
    FOR (i,0,m)
    {
        scanf("%d", &B[i]);
        BB[i] = B[i];
    }
    FOR (i,0,n)
    {
        scanf("%d", &A[i]);
        AA[i] = A[i];
    }
    sort(AA, AA+n);
    sort(BB, BB+m);
    FOR (i,0,n)
    {
        int pos = lower_bound(BB, BB+m, h - AA[i]) - BB;
        C[i] = m - pos;
        //cout << AA[i] << ' ' << C[i] << endl;
        I[i] = lower_bound(AA, AA+n, A[i]) - AA;
    }
    int res = 0;
    FOR (i,0,n)
    {
        W[i] = M[i] = INF;
        D[i] = 0;
    }
    FOR (i,0,m)
        add(I[i]);
    for (int i = 0; i+m-1 < n; i++)
    {
        /*FOR (j,0,n)
            cout << W[j] << ' ';
        cout << endl;
        cout << endl;*/
        int f = get();
        //cout << f << endl;
        if (f >= 0)
            ++ res;
        del(I[i]);
        if (i+m < n)
            add(I[i+m]);
    }
    printf("%d\n", res);

    return 0;
}