#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long md) {
  long long res = 1;
  x %= md;
  while (y > 0) {
    if (y & 1) res = (res * x) % md;
    x = (x * x) % md;
    y = y >> 1;
  }
  return res % md;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  long long n, k;
  cin >> n >> k;
  std::vector<long long> v(n, 0);
  for (long long i = 0; i < n; ++i) cin >> v[i];
  long long ans = 0;
  for (long long i = 0; i < n; ++i)
    if (v[i] + k <= 5) ans++;
  cout << ans / 3;
}
