#include <bits/stdc++.h>

using namespace std;

long long ans, n, m, x, y, a[100005];
bool b[100005];

int main() {

    cin >> n >> m;
    b[1] = 1;

    for (int j = 1; j <= m; ++j){
        cin >> x >> y;
        if(a[x] != -1 && b[x]) b[y] = 1;
        a[y]++;
        a[x]--;
        if (a[x] == -1) b[x] = 0;
    }
    for (int i = 1; i <= n; ++i){
        ans += b[i];
    }

    cout << ans;

    return 0;

}
