#include <bits/stdc++.h>
using namespace std;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
void c_p_c() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int32_t main() {
  long long n, k, count = 0;
  cin >> n >> k;
  long long a[2001];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    if (5 - a[i] >= k) {
      count++;
    }
  }
  std::cout << count / 3 << '\n';
}
