#include <bits/stdc++.h>

using namespace std;

long long n, k, v[1000001], nr, i, j, maxi, sol[1000001], zro;

int main()
{
    cin >> n >> k;

    for ( i = 1; i <= n; i++ ) {
        cin >> v[i];
        zro += (v[i] == 0);
    }
    if ( zro >= 5 ) {
        cout << "1";
    }
    else {
        cout << "0";
    }

    return 0;
}
