#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ar[n];
  for (int i = int(0); i < int(n); i++) cin >> ar[i];
  sort(ar, ar + n);
  int ans = 0;
  for (int i = 2; i < n; i += 3)
    if (ar[i] + k <= 5) ans++;
  cout << ans;
}
