#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void c_p_c() {}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  c_p_c();
  long long n, k;
  cin >> n >> k;
  long long arr[10000];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  if (n < 3) {
    cout << "0" << endl;
  } else {
    long long c = 0;
    for (long long i = 2; i < n; i = i + 3) {
      if (5 - arr[i] >= k) {
        c++;
      }
    }
    cout << c << endl;
  }
}
